using System;
using System.Xml;
public class XPathSelectNodes {
private static void Main() {
// Load the document.
XmlDocument doc = new XmlDocument();
doc.Load("books.xml");
XmlNodeList nodes = doc.SelectNodes("/books/A/B");
foreach (XmlNode node in nodes) {
Console.WriteLine(node.InnerText);
}
}
}
/*
<books>
<A property="a">
<B>text</B>
<C>textg</C>
<D>99999</D>
</A>
</books>
*/
|