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