XPathNavigator in the .NET Framework
The XPath functionality is the ability to query a data store for some node or set of nodes. The XPathNavigator class provides the methods required to implement XPath queries over any data store, and is based on the data model described in the XML Path Language (XPath) 1.0 Recommendation (www.w3.org/TR/xpath.html). A data store is defined as data in a file system, database, or object such as System.Xml.XmlDocument, or System.Data.Dataset. The XPathNavigator reads data from any data store using a cursor model that allows forward and backwards movement. It is a read-only cursor, and does not allow editing. If you need editing capabilities use the XML Document Object Model (DOM).
The XPathNavigator is useful for executing XPath queries. A set of nodes can be selected from any store that implements the IXPathNavigable class. You call CreateNavigator method as defined in IXPathNavigable to return an XPathNavigator and use it for XPath queries. Classes that already implement IXPathNavigable include XPathDocument, XmlDocument, XmlDataDocument, and XmlNode.
This section is specifically on the XPathNavigator and its ability to provide a cursor-like, random access method of moving through a set of nodes.
The XPathNavigator is found in the System.Xml.XPath Namespace. The following table lists more information on all the classes available in the System.Xml.XPath namespace, classes defined in that namespace, a description of their use, and links to their reference documentation.
|XPathNavigator Class||Defines a read-only, random access cursor model over any store. Supports the XPath data model, allowing performant XSLT over any store that implements this abstract class.|
|XPathNodeIterator Class||Used to iterate over a set of nodes selected by calling a method that executes an XPath query, such as the Select method.|
|IXPathNavigable Interface||Used to create an XPathNavigator class. Classes that implement the IXPathNavigable provide the ability to create navigators using the CreateNavigator method.|
|XPathDocument Class||Provides a fast and performant cache for XML document processing using XSLT.|
|XPathExpression Class||Encapsulates a compiled XPath expression. This class is returned as a result of a call to the Compile method, and is used by the Select, Evaluate, and Matches methods.|
Node Types Recognized with XPath Queries | Node Set Navigation Using XPath Queries | Attribute and Namespace Navigation Using XPathNavigator | Compile, Select, Evaluate, and Matches with XPath and XPathExpressions | XPathNavigator over Different Stores