[dba-VB] regex

Francisco Tapia fhtapia at gmail.com
Thu Mar 22 10:14:34 CDT 2012


woke up to kick this out,

Public Function GetValue(oXMLnode, xNode)
    if xNode = "" Then
        GetValue = ""
    Else
        dim iEndTag, i
        iEndTag = instr(1, oXMLnode, "</span></td>",0)

        if iEndTag > 0 Then
            i = iEndTag 'Starts @ Tag "</span></td>" and walks backwards
            While Mid(oXMLnode, i, 1) <> ">"
                i = i - 1
            Wend
        i = i + 1 'skip the ">" character
        GetValue = MID(oXMLnode, i , iEndTag - i)
        end if
    end if
End Function

all my tags in the HTML page end with </span></td> for each section, and
that is predictable.  So this function rips out the data in the SPAN tag.
I still have an issue trying to punch this out as an XML value as the
0Slash value seems to be the bad character... I don't know yet how to clean
it up...

my error message for that odd character is this:
XML Parsing Error: not well-formed
Location: http://localserver/myhtml2xml.asp
Line Number 1, Column 81:<root LastUpdated="03/14/2012
06:38:16"><row><standard>Liner Kit, 1.75" MAX </standard></row></root >
--------------------------------------------------------------------------------^

on my browser the caret points to the square text that gets displayed in my
browser.

-Francisco
http://bit.ly/sqlthis   | Tsql and More...
 <http://db.tt/JeXURAx>




On Thu, Mar 22, 2012 at 02:55, Gustav Brock <Gustav at cactus.dk> wrote:

> Hi Hans and Francisco
>
> Found this monster but can't believe there shouldn't be an easier approach:
>
>
> http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-compact-framework/3530/UrlEncode-UrlDecode
>
> Perhaps this will do:
>
>
> http://dotnet-snippets.de/dns/austauch-von-kritischen-zeichen-in-einem--string-SID585.aspx
>
> but still, wouldn't the .Net framework have built in methods for this like
> WebUtility.HtmlEncode() and .HtmlDecode().
>
> What is the official naming of this encoding style?
>
> /gustav
>
>
> >>> hans.andersen at phulse.com 22-03-2012 10:07 >>>
> Gustav,
>
> Unless I am mistaken, I think what Francisco is asking is how to convert
> HTML entities into extended characters. Ie. Ø -> Ø
>
> In PHP, for instance, this would be htmlentities() and
> html_entity_decode(). I don't think going down the route of regular
> expressions would even work, but I feign ignorance when it comes to ASP. It
> may not even be possible without coding in your own lookup table in code
> (which isn't all that hard, if you look for the right resources, i.e.:
> http://ascii.cl/htmlcodes.htm
>
> Hans
>
>
> On 2012-03-22, at 1:26 AM, Gustav Brock wrote:
>
> > Hi Francisco
> >
> > I may be missing something, but what do mean by "a printable character
> by xml". The Ø is perfectly printable (at least here where it belongs to
> our national set of characters!).
> >
> > By the way, the diameter sign is not really an "O-slash" but a true
> circle with a 45 degrees angled line across. It can be found in the Symbol
> OpenType font (symbol.ttf) from Monotype Corporation as well as the old
> Microsoft Symbol bitmap font, symbole.fon.
> >
> > /gustav
> >
> >
> >>>> fhtapia at gmail.com 22-03-2012 07:23 >>>
> > anybody here good with regex? or classic ASP?
> >
> > I need to convert the following Ø to a printable character by
> xml, I
> > am using the following object to read a webpage on my server that is not
> > pre-parsed in XML and it's the way the source system works...The idea is
> to
> > be able to yank the text [Liner Kit, 1.75" MAX Ø] out of the original
> > document and push it back out via XML so when I hit the url it looks like
> > http://localserver/myhtml2xml.asp and I get a standard xml feed using
> the
> > XML document, but I keep getting an error reading that O slash character,
> > other than that one character I can't seem to nab it, I've tried instr
> for
> > the exact character but to no avail, my current function just does a few
> > instr functions to nab the html down to this node, but I really probably
> > ought to get down to the span tag instead of the td tag.  If you have
> > ideas, let me know it's late and I need to get this thing kick
> started... :(
> >
> > Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
> >
> > <td id="ANALYSIS_interactive_pivot_ruid9648" BiTp="h2" cc="5" rr="1382"
> > align="left" class="urSTTD urSTTDBdr urSTSHL2"
> > style="vertical-align:top;height:21px;"><span
> > id="ANALYSIS_interactive_mc9691_tv" ct="TV" class="urTxtStd"
> > style="white-space:nowrap;">Liner Kit, 1.75" MAX Ø</span></td>
> >
> >
> > -Francisco
> > http://bit.ly/sqlthis   | Tsql and More...
> > <http://db.tt/JeXURAx>
> >
> >
> >
> > _______________________________________________
> > dba-VB mailing list
> > dba-VB at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-vb
> > http://www.databaseadvisors.com
> >
>
>
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>
>
>
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>
>


More information about the dba-VB mailing list