[ Team LiB ] Previous Section Next Section

XPathNavigator

System.Xml.XPath (system.xml.dll)abstract class

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 XPathNavigator( );
// Public Instance Properties
   public abstract string BaseURI{get; }
   public abstract bool HasAttributes{get; }
   public abstract bool HasChildren{get; }
   public abstract bool IsEmptyElement{get; }
   public abstract string LocalName{get; }
   public abstract string Name{get; }
   public abstract string NamespaceURI{get; }
   public abstract XmlNameTable NameTable{get; }
   public abstract XPathNodeType NodeType{get; }
   public abstract string Prefix{get; }
   public abstract string Value{get; }
   public abstract string XmlLang{get; }
// Public Instance Methods
   public abstract XPathNavigator Clone( );
   public virtual XmlNodeOrder ComparePosition(XPathNavigator nav);
   public virtual XPathExpression Compile(string xpath);
   public virtual object Evaluate(string xpath);
   public virtual object Evaluate(XPathExpression expr);
   public virtual object Evaluate(XPathExpression expr, XPathNodeIterator context);
   public abstract string GetAttribute(string localName, string namespaceURI);
   public abstract string GetNamespace(string name);
   public virtual bool IsDescendant(XPathNavigator nav);
   public abstract bool IsSamePosition(XPathNavigator other);
   public virtual bool Matches(string xpath);
   public virtual bool Matches(XPathExpression expr);
   public abstract bool MoveTo(XPathNavigator other);
   public abstract bool MoveToAttribute(string localName, string namespaceURI);
   public abstract bool MoveToFirst( );
   public abstract bool MoveToFirstAttribute( );
   public abstract bool MoveToFirstChild( );
   public bool MoveToFirstNamespace( );
   public abstract bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope);
   public abstract bool MoveToId(string id);
   public abstract bool MoveToNamespace(string name);
   public abstract bool MoveToNext( );
   public abstract bool MoveToNextAttribute( );
   public bool MoveToNextNamespace( );
   public abstract bool MoveToNextNamespace(XPathNamespaceScope namespaceScope);
   public abstract bool MoveToParent( );
   public abstract bool MoveToPrevious( );
   public abstract void MoveToRoot( );
   public virtual XPathNodeIterator Select(string xpath);
   public virtual XPathNodeIterator Select(XPathExpression expr);
   public virtual XPathNodeIterator SelectAncestors(string name, string namespaceURI, 
       bool matchSelf);
   public virtual XPathNodeIterator SelectAncestors(XPathNodeType type, bool matchSelf);
   public virtual XPathNodeIterator SelectChildren(string name, string namespaceURI);
   public virtual XPathNodeIterator SelectChildren(XPathNodeType type);
   public virtual XPathNodeIterator SelectDescendants(string name, string namespaceURI, 
       bool matchSelf);
   public virtual XPathNodeIterator SelectDescendants(XPathNodeType type, bool matchSelf);
   public override string ToString( );    
// overrides object
}

Returned By

System.Xml.XmlDataDocument.CreateNavigator( ), System.Xml.XmlNode.CreateNavigator( ), IXPathNavigable.CreateNavigator( ), XPathDocument.CreateNavigator( ), XPathNodeIterator.Current

Passed To

System.Xml.Xsl.IXsltContextFunction.Invoke( ), System.Xml.Xsl.XsltContext.PreserveWhitespace( ), System.Xml.Xsl.XslTransform.{Load( ), Transform( )}

    [ Team LiB ] Previous Section Next Section