Unable to Read XML using C# and XmlDocument -



Unable to Read XML using C# and XmlDocument -

i read xml file c#, error.

this xml

<?xml version="1.0" encoding="iso-8859-1"?> <omds xmlns="urn:omds20" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="urn:omds20 ./omds26-00.xsd"> <paket vunr="014" paketzpkterstell="2014-08-29t10:45:08.575" paketzpktletzterstell="2014-08-29t10:45:08.575" paketinhcd="vm" paketumfcd="g" vuversion="26-00" dvrnrabs="0"> <person .... <person .... <person ....

i read xml, xmlcontentnodes null. unable selectsinglenode path, cant find out should wrong here?

xmldocument doc = new xmldocument(); doc.load(openfiledialog1.filename); xmlnode xmlcontentnodes = doc.selectsinglenode("/omds/paket"); // error here xmlnodelist personnodelist = xmlcontentnodes.selectnodes("person"); foreach (xmlnode node in personnodelist) { .....

any help appreciated.

the usual namespace problem. try

xmlnamespacemanager mgr = new xmlnamespacemanager(new nametable()); mgr.addnamespace("d", "urn:omds20"); xmlnode xmlcontentnodes = doc.selectsinglenode("/d:omds/d:paket", mgr); xmlnodelist personnodelist = xmlcontentnodes.selectnodes("d:person", mgr);

c# xml

Comments

Popular posts from this blog

javascript - I need to update the text of a paragraph by inline edit -

javascript - THREE.js reposition vertices for RingGeometry -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -