Name

XPathNavigator

Synopsis

This class is a read-only representation of an XPathDocument based on the IXPathNavigable interface. It provides an easy-to-use data object for quick XPath-based navigation, particularly for XSLT transformations.

An XPathNavigator instance maintains its state with the current node position to provide the proper context for any XPath expression evaluation. Initially, the current node is the root node. The current node is changed by using the Select() method or the various MoveTo* methods. If the XPath expression evaluates to a set of nodes, the first node of the set is the current node for the XPathNavigator. All the Select* methods return an XPathNodeIterator object containing the set of nodes returned by the function. Except for plain-old Select(), the Select* functions do not change the current node of the XPathNavigator they are used on. Any actions on the XPathNodeIterator objects that they return also do not affect the originating object.

The Compile() method takes an XPath expression string and encapsulates it into a compiled XPathExpression object. XPathExpression objects are used by Select(), Evaluate(), and Matches() as input to search a node list.

public abstract class XPathNavigator : ICloneable {
// Protected Constructors
   protected method XPathNavigator();  
// Public Instance Properties
   public abstract field string BaseURI{get; } 
   public abstract field bool HasAttributes{get; } 
   public abstract field bool HasChildren{get; } public abstract field ...

Get C# in a Nutshell 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.