Having the parser decode > back into > etc?

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Hi All

Every time I've encountered < or > in XML, it has been in a CDATA tag and as a result, has needed no cooking to transform it back. I'm getting an XML stream and attaching an XPathNavigator to it then running XPATH queries. Where the tag data contains > , I'm wondering if there's a setting I can put on the XPathNavigator that will revert this to > for me?

VB.NET:
to create the navigator:

new XPathDocument(new StringReader(_theXml.ToString())).CreateNavigator()


to query the data:
.SelectSingleNode("/Invoice/InvoiceDetails[" & index & "]/BaseItemDetail/PartNumDetail/PartDesc").Value
 
The less/greater chars are unescaped here as I can see.
 
Funnily enough, I was looking for the same thing this morning (but in the opposite direction). Would this help?

VB.NET:
            Imports System.Web.HttpUtility

...

            strAfter = HtmlDecode(strBefore)
 
The less/greater chars are unescaped here as I can see.

It's not often youre wrong.. But I might just have to admit youre right again..

I should have taken a look at the original XML before complaining that the parser wasnt decoding:

VB.NET:
<PartDesc>&gt;500 3 YEARS</PartDesc>

Doh!

Thanks John..
 
Back
Top