Using XPath
The
System.Xml.XPath
assembly is relatively small,
containing only five classes, six enumerations, and one interface.
There are two ways to select nodes from an XML document with XPath.
The first, which was introduced in Chapter 5, uses
the SelectNodes( )
and SelectSingleNode(
)
methods of XmlNode
. The second way
uses the XPathNavigator
class, obtained by calling
XmlNode.GetNavigator( )
or
XPathDocument.GetNavigator( )
.
In this section, I’ll discuss these methods of using XPath in .NET.
Get .NET & XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.