How to select a Node in an XMLDocument?

  • Thread starter Thread starter Richard
  • Start date Start date
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.
 
You can use the indexer to locate specific nodes in the document e.g.

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

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

Peter
 
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.
 
Back
Top