How to select a Node in an XMLDocument?

R

Richard

Hi All,

How do i select a Node from an XMLDocument, and if i have that one how to
select a specific childnode? It seems all the usefull methods (selectnode
etc.) have been left out of the compact version (why oooh why).

Richard.
 
P

Peter Foot [MVP]

You can use the indexer to locate specific nodes in the document e.g.

[C#]
myxmldoc["mynode"].OuterXml;

[VB]
myxmldoc("mynode").OuterXml;

Peter
 
Z

Zordiac

Peter maybe it is because I am not that familiar with xml but I obtain
a nullreferenceexception when trying :

myxmldoc("child").OuterXml (
eg dom("child").OuterXml used in code link below

Also how does this help you with selecting a node list? As in:

Dim nodelist As XmlNodeList = dom.SelectNodes("//child")
For Each node In nodelist

http://support.microsoft.com/default.aspx?scid=kb;en-us;308063&Product=NETFrame


Peter Foot said:
You can use the indexer to locate specific nodes in the document e.g.

[C#]
myxmldoc["mynode"].OuterXml;

[VB]
myxmldoc("mynode").OuterXml;

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

Richard said:
Hi All,

How do i select a Node from an XMLDocument, and if i have that one how to
select a specific childnode? It seems all the usefull methods (selectnode
etc.) have been left out of the compact version (why oooh why).

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top