Share via


XPathNavigator Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides a cursor model for navigating and editing XML data.

Inheritance Hierarchy

System.Object
  System.Xml.XPath.XPathItem
    System.Xml.XPath.XPathNavigator

Namespace:  System.Xml.XPath
Assembly:  System.Xml.XPath (in System.Xml.XPath.dll)

Syntax

'Declaration
<DebuggerDisplayAttribute("{debuggerDisplayProxy}")> _
Public MustInherit Class XPathNavigator _
    Inherits XPathItem _
    Implements IXPathNavigable, IXmlNamespaceResolver
[DebuggerDisplayAttribute("{debuggerDisplayProxy}")]
public abstract class XPathNavigator : XPathItem, 
    IXPathNavigable, IXmlNamespaceResolver

The XPathNavigator type exposes the following members.

Constructors

  Name Description
Protected method XPathNavigator Initializes a new instance of the XPathNavigator class.

Top

Properties

  Name Description
Public property BaseURI When overridden in a derived class, gets the base URI for the current node.
Public property CanEdit Gets a value indicating whether the XPathNavigator can edit the underlying XML data.
Public property HasAttributes Gets a value indicating whether the current node has any attributes.
Public property HasChildren Gets a value indicating whether the current node has any child nodes.
Public property InnerXml Gets or sets the markup representing the child nodes of the current node.
Public property IsEmptyElement When overridden in a derived class, gets a value indicating whether the current node is an empty element without an end element tag.
Public property IsNode Gets a value indicating if the current node represents an XPath node. (Overrides XPathItem.IsNode.)
Public property LocalName When overridden in a derived class, gets the Name of the current node without any namespace prefix.
Public property Name When overridden in a derived class, gets the qualified name of the current node.
Public property NamespaceURI When overridden in a derived class, gets the namespace URI of the current node.
Public property NameTable When overridden in a derived class, gets the XmlNameTable of the XPathNavigator.
Public propertyStatic member NavigatorComparer Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.
Public property NodeType When overridden in a derived class, gets the XPathNodeType of the current node.
Public property OuterXml Gets or sets the markup representing the opening and closing tags of the current node and its child nodes.
Public property Prefix When overridden in a derived class, gets the namespace prefix associated with the current node.
Public property UnderlyingObject Used by XPathNavigator implementations which provide a "virtualized" XML view over a store, to provide access to underlying objects.
Public property Value When overridden in a derived class, gets the string value of the item. (Inherited from XPathItem.)
Public property XmlLang Gets the xml:lang scope for the current node.

Top

Methods

  Name Description
Public method AppendChild() Returns an XmlWriter object used to create one or more new child nodes at the end of the list of child nodes of the current node.
Public method AppendChild(String) Creates a new child node at the end of the list of child nodes of the current node using the XML data string specified.
Public method AppendChild(XmlReader) Creates a new child node at the end of the list of child nodes of the current node using the XML contents of the XmlReader object specified.
Public method AppendChild(XPathNavigator) Creates a new child node at the end of the list of child nodes of the current node using the nodes in the XPathNavigator specified.
Public method AppendChildElement Creates a new child element node at the end of the list of child nodes of the current node using the namespace prefix, local name and namespace URI specified with the value specified.
Public method Clone When overridden in a derived class, creates a new XPathNavigator positioned at the same node as this XPathNavigator.
Public method ComparePosition Compares the position of the current XPathNavigator with the position of the XPathNavigator specified.
Public method Compile Compiles a string representing an XPath expression and returns an XPathExpression object.
Public method CreateAttribute Creates an attribute node on the current element node using the namespace prefix, local name and namespace URI specified with the value specified.
Public method CreateAttributes Returns an XmlWriter object used to create new attributes on the current element.
Public method CreateNavigator Returns a copy of the XPathNavigator.
Public method DeleteRange Deletes a range of sibling nodes from the current node to the node specified.
Public method DeleteSelf Deletes the current node and its child nodes.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method Evaluate(String) Evaluates the specified XPath expression and returns the typed result.
Public method Evaluate(XPathExpression) Evaluates the XPathExpression and returns the typed result.
Public method Evaluate(String, IXmlNamespaceResolver) Evaluates the specified XPath expression and returns the typed result, using the IXmlNamespaceResolver object specified to resolve namespace prefixes in the XPath expression.
Public method Evaluate(XPathExpression, XPathNodeIterator) Uses the supplied context to evaluate the XPathExpression, and returns the typed result.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public method GetAttribute Gets the value of the attribute with the specified local name and namespace URI.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetNamespace Returns the value of the namespace node corresponding to the specified local name.
Public method GetNamespacesInScope Returns the in-scope namespaces of the current node.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InsertAfter() Returns an XmlWriter object used to create a new sibling node after the currently selected node.
Public method InsertAfter(String) Creates a new sibling node after the currently selected node using the XML string specified.
Public method InsertAfter(XmlReader) Creates a new sibling node after the currently selected node using the XML contents of the XmlReader object specified.
Public method InsertAfter(XPathNavigator) Creates a new sibling node after the currently selected node using the nodes in the XPathNavigator object specified.
Public method InsertBefore() Returns an XmlWriter object used to create a new sibling node before the currently selected node.
Public method InsertBefore(String) Creates a new sibling node before the currently selected node using the XML string specified.
Public method InsertBefore(XmlReader) Creates a new sibling node before the currently selected node using the XML contents of the XmlReader object specified.
Public method InsertBefore(XPathNavigator) Creates a new sibling node before the currently selected node using the nodes in the XPathNavigator specified.
Public method InsertElementAfter Creates a new sibling element after the current node using the namespace prefix, local name and namespace URI specified, with the value specified.
Public method InsertElementBefore Creates a new sibling element before the current node using the namespace prefix, local name, and namespace URI specified, with the value specified.
Public method IsDescendant Determines whether the specified XPathNavigator is a descendant of the current XPathNavigator.
Public method IsSamePosition When overridden in a derived class, determines whether the current XPathNavigator is at the same position as the specified XPathNavigator.
Public method LookupNamespace Gets the namespace URI for the specified prefix.
Public method LookupPrefix Gets the prefix declared for the specified namespace URI.
Public method Matches(String) Determines whether the current node matches the specified XPath expression.
Public method Matches(XPathExpression) Determines whether the current node matches the specified XPathExpression.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method MoveTo When overridden in a derived class, moves the XPathNavigator to the same position as the specified XPathNavigator.
Public method MoveToAttribute Moves the XPathNavigator to the attribute with the matching local name and namespace URI.
Public method MoveToChild(XPathNodeType) Moves the XPathNavigator to the child node of the XPathNodeType specified.
Public method MoveToChild(String, String) Moves the XPathNavigator to the child node with the local name and namespace URI specified.
Public method MoveToFirst Moves the XPathNavigator to the first sibling node of the current node.
Public method MoveToFirstAttribute When overridden in a derived class, moves the XPathNavigator to the first attribute of the current node.
Public method MoveToFirstChild When overridden in a derived class, moves the XPathNavigator to the first child node of the current node.
Public method MoveToFirstNamespace() Moves the XPathNavigator to first namespace node of the current node.
Public method MoveToFirstNamespace(XPathNamespaceScope) When overridden in a derived class, moves the XPathNavigator to the first namespace node that matches the XPathNamespaceScope specified.
Public method MoveToFollowing(XPathNodeType) Moves the XPathNavigator to the following element of the XPathNodeType specified in document order.
Public method MoveToFollowing(String, String) Moves the XPathNavigator to the element with the local name and namespace URI specified in document order.
Public method MoveToFollowing(XPathNodeType, XPathNavigator) Moves the XPathNavigator to the following element of the XPathNodeType specified, to the boundary specified, in document order.
Public method MoveToFollowing(String, String, XPathNavigator) Moves the XPathNavigator to the element with the local name and namespace URI specified, to the boundary specified, in document order.
Public method MoveToId When overridden in a derived class, moves to the node that has an attribute of type ID whose value matches the specified String.
Public method MoveToNamespace Moves the XPathNavigator to the namespace node with the specified namespace prefix.
Public method MoveToNext() When overridden in a derived class, moves the XPathNavigator to the next sibling node of the current node.
Public method MoveToNext(XPathNodeType) Moves the XPathNavigator to the next sibling node of the current node that matches the XPathNodeType specified.
Public method MoveToNext(String, String) Moves the XPathNavigator to the next sibling node with the local name and namespace URI specified.
Public method MoveToNextAttribute When overridden in a derived class, moves the XPathNavigator to the next attribute.
Public method MoveToNextNamespace() Moves the XPathNavigator to the next namespace node.
Public method MoveToNextNamespace(XPathNamespaceScope) When overridden in a derived class, moves the XPathNavigator to the next namespace node matching the XPathNamespaceScope specified.
Public method MoveToParent When overridden in a derived class, moves the XPathNavigator to the parent node of the current node.
Public method MoveToPrevious When overridden in a derived class, moves the XPathNavigator to the previous sibling node of the current node.
Public method MoveToRoot Moves the XPathNavigator to the root node that the current node belongs to.
Public method PrependChild() Returns an XmlWriter object used to create a new child node at the beginning of the list of child nodes of the current node.
Public method PrependChild(String) Creates a new child node at the beginning of the list of child nodes of the current node using the XML string specified.
Public method PrependChild(XmlReader) Creates a new child node at the beginning of the list of child nodes of the current node using the XML contents of the XmlReader object specified.
Public method PrependChild(XPathNavigator) Creates a new child node at the beginning of the list of child nodes of the current node using the nodes in the XPathNavigator object specified.
Public method PrependChildElement Creates a new child element at the beginning of the list of child nodes of the current node using the namespace prefix, local name, and namespace URI specified with the value specified.
Public method ReadSubtree Returns an XmlReader object that contains the current node and its child nodes.
Public method ReplaceRange Replaces a range of sibling nodes from the current node to the node specified.
Public method ReplaceSelf(String) Replaces the current node with the content of the string specified.
Public method ReplaceSelf(XmlReader) Replaces the current node with the contents of the XmlReader object specified.
Public method ReplaceSelf(XPathNavigator) Replaces the current node with the contents of the XPathNavigator object specified.
Public method Select(String) Selects a node set, using the specified XPath expression.
Public method Select(XPathExpression) Selects a node set using the specified XPathExpression.
Public method Select(String, IXmlNamespaceResolver) Selects a node set using the specified XPath expression with the IXmlNamespaceResolver object specified to resolve namespace prefixes.
Public method SelectAncestors(XPathNodeType, Boolean) Selects all the ancestor nodes of the current node that have a matching XPathNodeType.
Public method SelectAncestors(String, String, Boolean) Selects all the ancestor nodes of the current node that have the specified local name and namespace URI.
Public method SelectChildren(XPathNodeType) Selects all the child nodes of the current node that have the matching XPathNodeType.
Public method SelectChildren(String, String) Selects all the child nodes of the current node that have the local name and namespace URI specified.
Public method SelectDescendants(XPathNodeType, Boolean) Selects all the descendant nodes of the current node that have a matching XPathNodeType.
Public method SelectDescendants(String, String, Boolean) Selects all the descendant nodes of the current node with the local name and namespace URI specified.
Public method SelectSingleNode(String) Selects a single node in the XPathNavigator using the specified XPath query.
Public method SelectSingleNode(XPathExpression) Selects a single node in the XPathNavigator using the specified XPathExpression object.
Public method SelectSingleNode(String, IXmlNamespaceResolver) Selects a single node in the XPathNavigator object using the specified XPath query with the IXmlNamespaceResolver object specified to resolve namespace prefixes.
Public method SetValue Sets the value of the current node.
Public method ToString Gets the text value of the current node. (Overrides Object.ToString().)
Public method WriteSubtree Streams the current node and its child nodes to the XmlWriter object specified.

Top

Remarks

The XPathNavigator class in the System.Xml.XPath namespace is an abstract class which defines a cursor model for navigating and editing XML information items as instances of the XQuery 1.0 and XPath 2.0 Data Model.

An XPathNavigator object is created from a class that implements the IXPathNavigable interface such as the XPathDocument and XmlDocument classes. XPathNavigator objects created by XPathDocument objects are read-only while XPathNavigator objects created by XmlDocument objects can be edited. An XPathNavigator object's read-only or editable status is determined using the CanEdit property of the XPathNavigator class.

For more information about processing XML data using the XPath data model, see the Process XML Data Using the XPath Data Model topic.

Security noteSecurity Note:

Exceptions raised as a result of using the XPathNavigator class, such as the XPathException class, may contain sensitive information that should not be exposed in untrusted scenarios. Exceptions should be properly handled so that this sensitive information is not exposed in untrusted scenarios.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference