.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("&", "&") xmlfile = xmlfile.replace(""", chr(34)) xmlfile = xmlfile.replace("'", "'") xmlfile = xmlfile.replace("<", "<") xmlfile = xmlfile.replace(">", ">") 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 doesn
t show or how read xml document full of ampersants correctly?
here sample code xml:
<team> <name id="grizzlie"> <member firstname="thomas" secondname="andreson" /><member firstname="nick" secondname="patterson" /><member firstname="james" secondname="cooker"/></name> </team>
i think problem may xpath query: condition @=grizzlie won't match because looking attribute empty name. perhaps mean
/team[@name='grizzlie']/member