.net - How to select nodes from xml file when it`s full of ampersands? -


i have full xml document ampersands , having problems loading it. tried replacing ampersands, error < symbol. here conversion code:

        dim xmlfile string          dim str streamreader = new streamreader("doc.xml")          xmlfile = str.readtoend()           xmlfile = xmlfile.replace("&amp;", "&")          xmlfile = xmlfile.replace("&quot;", chr(34))          xmlfile = xmlfile.replace("&apos;", "'")          xmlfile = xmlfile.replace("&lt;", "<")          xmlfile = xmlfile.replace("&gt;", ">")          dim xmldoc new xmldocument         xmldoc.loadxml(xmlfile) 

from here getting error...

if try load xml file straight without ampersands conversion, doesn`t select node if know position

dim names xmlnodelist = xmldoc.selectnodes("/team/name[@id=grizzlie]/member") each name in names msgbox(name.outerxml) 

but see no message after running app...

any ideas why its doesnt show or how read xml document full of ampersants correctly?

here sample code xml:

<team> <name id="grizzlie"&gt; &lt;member firstname=&quot;thomas&quot; secondname=&quot;andreson&quot; /&gt;&lt;member firstname=&quot;nick&quot; secondname=&quot;patterson&quot; /&gt;&lt;member firstname=&quot;james&quot; secondname=&quot;cooker&quot;/&gt;&lt;/name&gt; </team> 

i think problem may xpath query: condition @=grizzlie won't match because looking attribute empty name. perhaps mean

/team[@name='grizzlie']/member


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo