XPathNavigator Class

Provides a cursor model for navigating and editing XML data.

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

public abstract class XPathNavigator : XPathItem, 
	ICloneable, IXPathNavigable, IXmlNamespaceResolver

The XPathNavigator type exposes the following members.

  NameDescription
Protected methodXPathNavigatorInitializes a new instance of the XPathNavigator class.
Top

  NameDescription
Public propertyBaseURIWhen overridden in a derived class, gets the base URI for the current node.
Public propertyCanEditGets a value indicating whether the XPathNavigator can edit the underlying XML data.
Public propertyHasAttributesGets a value indicating whether the current node has any attributes.
Public propertyHasChildrenGets a value indicating whether the current node has any child nodes.
Public propertyInnerXmlGets or sets the markup representing the child nodes of the current node.
Public propertyIsEmptyElementWhen overridden in a derived class, gets a value indicating whether the current node is an empty element without an end element tag.
Public propertyIsNodeGets a value indicating if the current node represents an XPath node. (Overrides XPathItem.IsNode.)
Public propertyLocalNameWhen overridden in a derived class, gets the Name of the current node without any namespace prefix.
Public propertyNameWhen overridden in a derived class, gets the qualified name of the current node.
Public propertyNamespaceURIWhen overridden in a derived class, gets the namespace URI of the current node.
Public propertyNameTableWhen overridden in a derived class, gets the XmlNameTable of the XPathNavigator.
Public propertyStatic memberNavigatorComparerGets an IEqualityComparer used for equality comparison of XPathNavigator objects.
Public propertyNodeTypeWhen overridden in a derived class, gets the XPathNodeType of the current node.
Public propertyOuterXmlGets or sets the markup representing the opening and closing tags of the current node and its child nodes.
Public propertyPrefixWhen overridden in a derived class, gets the namespace prefix associated with the current node.
Public propertySchemaInfoGets the schema information that has been assigned to the current node as a result of schema validation.
Public propertyTypedValueGets the current node as a boxed object of the most appropriate .NET Framework type. (Overrides XPathItem.TypedValue.)
Public propertyUnderlyingObjectUsed by XPathNavigator implementations which provide a "virtualized" XML view over a store, to provide access to underlying objects.
Public propertyValueWhen overridden in a derived class, gets the string value of the item. (Inherited from XPathItem.)
Public propertyValueAsBooleanGets the current node's value as a Boolean. (Overrides XPathItem.ValueAsBoolean.)
Public propertyValueAsDateTimeGets the current node's value as a DateTime. (Overrides XPathItem.ValueAsDateTime.)
Public propertyValueAsDoubleGets the current node's value as a Double. (Overrides XPathItem.ValueAsDouble.)
Public propertyValueAsIntGets the current node's value as an Int32. (Overrides XPathItem.ValueAsInt.)
Public propertyValueAsLongGets the current node's value as an Int64. (Overrides XPathItem.ValueAsLong.)
Public propertyValueTypeGets the .NET Framework Type of the current node. (Overrides XPathItem.ValueType.)
Public propertyXmlLangGets the xml:lang scope for the current node.
Public propertyXmlTypeGets the XmlSchemaType information for the current node. (Overrides XPathItem.XmlType.)
Top

  NameDescription
Public methodAppendChild()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 methodAppendChild(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 methodAppendChild(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 methodAppendChild(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 methodAppendChildElementCreates 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 methodCheckValidityVerifies that the XML data in the XPathNavigator conforms to the XML Schema definition language (XSD) schema provided.
Public methodCloneWhen overridden in a derived class, creates a new XPathNavigator positioned at the same node as this XPathNavigator.
Public methodComparePositionCompares the position of the current XPathNavigator with the position of the XPathNavigator specified.
Public methodCompileCompiles a string representing an XPath expression and returns an XPathExpression object.
Public methodCreateAttributeCreates an attribute node on the current element node using the namespace prefix, local name and namespace URI specified with the value specified.
Public methodCreateAttributesReturns an XmlWriter object used to create new attributes on the current element.
Public methodCreateNavigatorReturns a copy of the XPathNavigator.
Public methodDeleteRangeDeletes a range of sibling nodes from the current node to the node specified.
Public methodDeleteSelfDeletes the current node and its child nodes.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodEvaluate(String)Evaluates the specified XPath expression and returns the typed result.
Public methodEvaluate(XPathExpression)Evaluates the XPathExpression and returns the typed result.
Public methodEvaluate(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 methodEvaluate(XPathExpression, XPathNodeIterator)Uses the supplied context to evaluate the XPathExpression, and returns the typed result.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAttributeGets the value of the attribute with the specified local name and namespace URI.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetNamespaceReturns the value of the namespace node corresponding to the specified local name.
Public methodGetNamespacesInScopeReturns the in-scope namespaces of the current node.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInsertAfter()Returns an XmlWriter object used to create a new sibling node after the currently selected node.
Public methodInsertAfter(String)Creates a new sibling node after the currently selected node using the XML string specified.
Public methodInsertAfter(XmlReader)Creates a new sibling node after the currently selected node using the XML contents of the XmlReader object specified.
Public methodInsertAfter(XPathNavigator)Creates a new sibling node after the currently selected node using the nodes in the XPathNavigator object specified.
Public methodInsertBefore()Returns an XmlWriter object used to create a new sibling node before the currently selected node.
Public methodInsertBefore(String)Creates a new sibling node before the currently selected node using the XML string specified.
Public methodInsertBefore(XmlReader)Creates a new sibling node before the currently selected node using the XML contents of the XmlReader object specified.
Public methodInsertBefore(XPathNavigator)Creates a new sibling node before the currently selected node using the nodes in the XPathNavigator specified.
Public methodInsertElementAfterCreates a new sibling element after the current node using the namespace prefix, local name and namespace URI specified, with the value specified.
Public methodInsertElementBeforeCreates a new sibling element before the current node using the namespace prefix, local name, and namespace URI specified, with the value specified.
Public methodIsDescendantDetermines whether the specified XPathNavigator is a descendant of the current XPathNavigator.
Public methodIsSamePositionWhen overridden in a derived class, determines whether the current XPathNavigator is at the same position as the specified XPathNavigator.
Public methodLookupNamespaceGets the namespace URI for the specified prefix.
Public methodLookupPrefixGets the prefix declared for the specified namespace URI.
Public methodMatches(String)Determines whether the current node matches the specified XPath expression.
Public methodMatches(XPathExpression)Determines whether the current node matches the specified XPathExpression.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodMoveToWhen overridden in a derived class, moves the XPathNavigator to the same position as the specified XPathNavigator.
Public methodMoveToAttributeMoves the XPathNavigator to the attribute with the matching local name and namespace URI.
Public methodMoveToChild(XPathNodeType)Moves the XPathNavigator to the child node of the XPathNodeType specified.
Public methodMoveToChild(String, String)Moves the XPathNavigator to the child node with the local name and namespace URI specified.
Public methodMoveToFirstMoves the XPathNavigator to the first sibling node of the current node.
Public methodMoveToFirstAttributeWhen overridden in a derived class, moves the XPathNavigator to the first attribute of the current node.
Public methodMoveToFirstChildWhen overridden in a derived class, moves the XPathNavigator to the first child node of the current node.
Public methodMoveToFirstNamespace()Moves the XPathNavigator to first namespace node of the current node.
Public methodMoveToFirstNamespace(XPathNamespaceScope)When overridden in a derived class, moves the XPathNavigator to the first namespace node that matches the XPathNamespaceScope specified.
Public methodMoveToFollowing(XPathNodeType)Moves the XPathNavigator to the following element of the XPathNodeType specified in document order.
Public methodMoveToFollowing(String, String)Moves the XPathNavigator to the element with the local name and namespace URI specified in document order.
Public methodMoveToFollowing(XPathNodeType, XPathNavigator)Moves the XPathNavigator to the following element of the XPathNodeType specified, to the boundary specified, in document order.
Public methodMoveToFollowing(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 methodMoveToIdWhen overridden in a derived class, moves to the node that has an attribute of type ID whose value matches the specified String.
Public methodMoveToNamespaceMoves the XPathNavigator to the namespace node with the specified namespace prefix.
Public methodMoveToNext()When overridden in a derived class, moves the XPathNavigator to the next sibling node of the current node.
Public methodMoveToNext(XPathNodeType)Moves the XPathNavigator to the next sibling node of the current node that matches the XPathNodeType specified.
Public methodMoveToNext(String, String)Moves the XPathNavigator to the next sibling node with the local name and namespace URI specified.
Public methodMoveToNextAttributeWhen overridden in a derived class, moves the XPathNavigator to the next attribute.
Public methodMoveToNextNamespace()Moves the XPathNavigator to the next namespace node.
Public methodMoveToNextNamespace(XPathNamespaceScope)When overridden in a derived class, moves the XPathNavigator to the next namespace node matching the XPathNamespaceScope specified.
Public methodMoveToParentWhen overridden in a derived class, moves the XPathNavigator to the parent node of the current node.
Public methodMoveToPreviousWhen overridden in a derived class, moves the XPathNavigator to the previous sibling node of the current node.
Public methodMoveToRootMoves the XPathNavigator to the root node that the current node belongs to.
Public methodPrependChild()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 methodPrependChild(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 methodPrependChild(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 methodPrependChild(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 methodPrependChildElementCreates 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 methodReadSubtreeReturns an XmlReader object that contains the current node and its child nodes.
Public methodReplaceRangeReplaces a range of sibling nodes from the current node to the node specified.
Public methodReplaceSelf(String)Replaces the current node with the content of the string specified.
Public methodReplaceSelf(XmlReader)Replaces the current node with the contents of the XmlReader object specified.
Public methodReplaceSelf(XPathNavigator)Replaces the current node with the contents of the XPathNavigator object specified.
Public methodSelect(String)Selects a node set, using the specified XPath expression.
Public methodSelect(XPathExpression)Selects a node set using the specified XPathExpression.
Public methodSelect(String, IXmlNamespaceResolver)Selects a node set using the specified XPath expression with the IXmlNamespaceResolver object specified to resolve namespace prefixes.
Public methodSelectAncestors(XPathNodeType, Boolean)Selects all the ancestor nodes of the current node that have a matching XPathNodeType.
Public methodSelectAncestors(String, String, Boolean)Selects all the ancestor nodes of the current node that have the specified local name and namespace URI.
Public methodSelectChildren(XPathNodeType)Selects all the child nodes of the current node that have the matching XPathNodeType.
Public methodSelectChildren(String, String)Selects all the child nodes of the current node that have the local name and namespace URI specified.
Public methodSelectDescendants(XPathNodeType, Boolean)Selects all the descendant nodes of the current node that have a matching XPathNodeType.
Public methodSelectDescendants(String, String, Boolean)Selects all the descendant nodes of the current node with the local name and namespace URI specified.
Public methodSelectSingleNode(String)Selects a single node in the XPathNavigator using the specified XPath query.
Public methodSelectSingleNode(XPathExpression)Selects a single node in the XPathNavigator using the specified XPathExpression object.
Public methodSelectSingleNode(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 methodSetTypedValueSets the typed value of the current node.
Public methodSetValueSets the value of the current node.
Public methodToStringGets the text value of the current node. (Overrides Object.ToString().)
Public methodValueAs(Type)Returns the item's value as the specified type. (Inherited from XPathItem.)
Public methodValueAs(Type, IXmlNamespaceResolver)Gets the current node's value as the Type specified, using the IXmlNamespaceResolver object specified to resolve namespace prefixes. (Overrides XPathItem.ValueAs(Type, IXmlNamespaceResolver).)
Public methodWriteSubtreeStreams the current node and its child nodes to the XmlWriter object specified.
Top

  NameDescription
Explicit interface implemetationPrivate methodICloneable.CloneCreates a new copy of the XPathNavigator object.
Top

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.

Notes to Inheritors

When you inherit from the XPathNavigator class, you must override the following members:

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft