XPathNavigator XPathNavigator XPathNavigator XPathNavigator Class

Definition

Provides a cursor model for navigating and editing XML data.

public ref class XPathNavigator abstract : System::Xml::XPath::XPathItem, ICloneable, System::Xml::IXmlNamespaceResolver, System::Xml::XPath::IXPathNavigable
public abstract class XPathNavigator : System.Xml.XPath.XPathItem, ICloneable, System.Xml.IXmlNamespaceResolver, System.Xml.XPath.IXPathNavigable
type XPathNavigator = class
    inherit XPathItem
    interface ICloneable
    interface IXPathNavigable
    interface IXmlNamespaceResolver
Public MustInherit Class XPathNavigator
Inherits XPathItem
Implements ICloneable, IXmlNamespaceResolver, IXPathNavigable
Inheritance
XPathNavigatorXPathNavigatorXPathNavigatorXPathNavigator
Derived
Implements

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.

Important

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:

Constructors

XPathNavigator() XPathNavigator() XPathNavigator() XPathNavigator()

Initializes a new instance of the XPathNavigator class.

Properties

BaseURI BaseURI BaseURI BaseURI

When overridden in a derived class, gets the base URI for the current node.

CanEdit CanEdit CanEdit CanEdit

Gets a value indicating whether the XPathNavigator can edit the underlying XML data.

HasAttributes HasAttributes HasAttributes HasAttributes

Gets a value indicating whether the current node has any attributes.

HasChildren HasChildren HasChildren HasChildren

Gets a value indicating whether the current node has any child nodes.

InnerXml InnerXml InnerXml InnerXml

Gets or sets the markup representing the child nodes of the current node.

IsEmptyElement IsEmptyElement IsEmptyElement IsEmptyElement

When overridden in a derived class, gets a value indicating whether the current node is an empty element without an end element tag.

IsNode IsNode IsNode IsNode

Gets a value indicating if the current node represents an XPath node.

LocalName LocalName LocalName LocalName

When overridden in a derived class, gets the Name of the current node without any namespace prefix.

Name Name Name Name

When overridden in a derived class, gets the qualified name of the current node.

NamespaceURI NamespaceURI NamespaceURI NamespaceURI

When overridden in a derived class, gets the namespace URI of the current node.

NameTable NameTable NameTable NameTable

When overridden in a derived class, gets the XmlNameTable of the XPathNavigator.

NavigatorComparer NavigatorComparer NavigatorComparer NavigatorComparer

Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.

NodeType NodeType NodeType NodeType

When overridden in a derived class, gets the XPathNodeType of the current node.

OuterXml OuterXml OuterXml OuterXml

Gets or sets the markup representing the opening and closing tags of the current node and its child nodes.

Prefix Prefix Prefix Prefix

When overridden in a derived class, gets the namespace prefix associated with the current node.

SchemaInfo SchemaInfo SchemaInfo SchemaInfo

Gets the schema information that has been assigned to the current node as a result of schema validation.

TypedValue TypedValue TypedValue TypedValue

Gets the current node as a boxed object of the most appropriate .NET Framework type.

UnderlyingObject UnderlyingObject UnderlyingObject UnderlyingObject

Used by XPathNavigator implementations which provide a "virtualized" XML view over a store, to provide access to underlying objects.

Value Value Value Value
ValueAsBoolean ValueAsBoolean ValueAsBoolean ValueAsBoolean

Gets the current node's value as a Boolean.

ValueAsDateTime ValueAsDateTime ValueAsDateTime ValueAsDateTime

Gets the current node's value as a DateTime.

ValueAsDouble ValueAsDouble ValueAsDouble ValueAsDouble

Gets the current node's value as a Double.

ValueAsInt ValueAsInt ValueAsInt ValueAsInt

Gets the current node's value as an Int32.

ValueAsLong ValueAsLong ValueAsLong ValueAsLong

Gets the current node's value as an Int64.

ValueType ValueType ValueType ValueType

Gets the .NET Framework Type of the current node.

XmlLang XmlLang XmlLang XmlLang

Gets the xml:lang scope for the current node.

XmlType XmlType XmlType XmlType

Gets the XmlSchemaType information for the current node.

Methods

AppendChild() AppendChild() AppendChild() 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.

AppendChild(String) AppendChild(String) AppendChild(String) 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.

AppendChild(XmlReader) AppendChild(XmlReader) AppendChild(XmlReader) 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.

AppendChild(XPathNavigator) AppendChild(XPathNavigator) AppendChild(XPathNavigator) 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.

AppendChildElement(String, String, String, String) AppendChildElement(String, String, String, String) AppendChildElement(String, String, String, String) AppendChildElement(String, String, String, String)

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.

CheckValidity(XmlSchemaSet, ValidationEventHandler) CheckValidity(XmlSchemaSet, ValidationEventHandler) CheckValidity(XmlSchemaSet, ValidationEventHandler) CheckValidity(XmlSchemaSet, ValidationEventHandler)

Verifies that the XML data in the XPathNavigator conforms to the XML Schema definition language (XSD) schema provided.

Clone() Clone() Clone() Clone()

When overridden in a derived class, creates a new XPathNavigator positioned at the same node as this XPathNavigator.

ComparePosition(XPathNavigator) ComparePosition(XPathNavigator) ComparePosition(XPathNavigator) ComparePosition(XPathNavigator)

Compares the position of the current XPathNavigator with the position of the XPathNavigator specified.

Compile(String) Compile(String) Compile(String) Compile(String)

Compiles a string representing an XPath expression and returns an XPathExpression object.

CreateAttribute(String, String, String, String) CreateAttribute(String, String, String, String) CreateAttribute(String, String, String, String) CreateAttribute(String, String, String, String)

Creates an attribute node on the current element node using the namespace prefix, local name and namespace URI specified with the value specified.

CreateAttributes() CreateAttributes() CreateAttributes() CreateAttributes()

Returns an XmlWriter object used to create new attributes on the current element.

CreateNavigator() CreateNavigator() CreateNavigator() CreateNavigator()

Returns a copy of the XPathNavigator.

DeleteRange(XPathNavigator) DeleteRange(XPathNavigator) DeleteRange(XPathNavigator) DeleteRange(XPathNavigator)

Deletes a range of sibling nodes from the current node to the node specified.

DeleteSelf() DeleteSelf() DeleteSelf() DeleteSelf()

Deletes the current node and its child nodes.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Evaluate(String) Evaluate(String) Evaluate(String) Evaluate(String)

Evaluates the specified XPath expression and returns the typed result.

Evaluate(String, IXmlNamespaceResolver) Evaluate(String, IXmlNamespaceResolver) Evaluate(String, IXmlNamespaceResolver) 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.

Evaluate(XPathExpression) Evaluate(XPathExpression) Evaluate(XPathExpression) Evaluate(XPathExpression)

Evaluates the XPathExpression and returns the typed result.

Evaluate(XPathExpression, XPathNodeIterator) Evaluate(XPathExpression, XPathNodeIterator) Evaluate(XPathExpression, XPathNodeIterator) Evaluate(XPathExpression, XPathNodeIterator)

Uses the supplied context to evaluate the XPathExpression, and returns the typed result.

GetAttribute(String, String) GetAttribute(String, String) GetAttribute(String, String) GetAttribute(String, String)

Gets the value of the attribute with the specified local name and namespace URI.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNamespace(String) GetNamespace(String) GetNamespace(String) GetNamespace(String)

Returns the value of the namespace node corresponding to the specified local name.

GetNamespacesInScope(XmlNamespaceScope) GetNamespacesInScope(XmlNamespaceScope) GetNamespacesInScope(XmlNamespaceScope) GetNamespacesInScope(XmlNamespaceScope)

Returns the in-scope namespaces of the current node.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InsertAfter() InsertAfter() InsertAfter() InsertAfter()

Returns an XmlWriter object used to create a new sibling node after the currently selected node.

InsertAfter(String) InsertAfter(String) InsertAfter(String) InsertAfter(String)

Creates a new sibling node after the currently selected node using the XML string specified.

InsertAfter(XmlReader) InsertAfter(XmlReader) InsertAfter(XmlReader) InsertAfter(XmlReader)

Creates a new sibling node after the currently selected node using the XML contents of the XmlReader object specified.

InsertAfter(XPathNavigator) InsertAfter(XPathNavigator) InsertAfter(XPathNavigator) InsertAfter(XPathNavigator)

Creates a new sibling node after the currently selected node using the nodes in the XPathNavigator object specified.

InsertBefore() InsertBefore() InsertBefore() InsertBefore()

Returns an XmlWriter object used to create a new sibling node before the currently selected node.

InsertBefore(String) InsertBefore(String) InsertBefore(String) InsertBefore(String)

Creates a new sibling node before the currently selected node using the XML string specified.

InsertBefore(XmlReader) InsertBefore(XmlReader) InsertBefore(XmlReader) InsertBefore(XmlReader)

Creates a new sibling node before the currently selected node using the XML contents of the XmlReader object specified.

InsertBefore(XPathNavigator) InsertBefore(XPathNavigator) InsertBefore(XPathNavigator) InsertBefore(XPathNavigator)

Creates a new sibling node before the currently selected node using the nodes in the XPathNavigator specified.

InsertElementAfter(String, String, String, String) InsertElementAfter(String, String, String, String) InsertElementAfter(String, String, String, String) InsertElementAfter(String, String, String, String)

Creates a new sibling element after the current node using the namespace prefix, local name and namespace URI specified, with the value specified.

InsertElementBefore(String, String, String, String) InsertElementBefore(String, String, String, String) InsertElementBefore(String, String, String, String) InsertElementBefore(String, String, String, String)

Creates a new sibling element before the current node using the namespace prefix, local name, and namespace URI specified, with the value specified.

IsDescendant(XPathNavigator) IsDescendant(XPathNavigator) IsDescendant(XPathNavigator) IsDescendant(XPathNavigator)

Determines whether the specified XPathNavigator is a descendant of the current XPathNavigator.

IsSamePosition(XPathNavigator) IsSamePosition(XPathNavigator) IsSamePosition(XPathNavigator) IsSamePosition(XPathNavigator)

When overridden in a derived class, determines whether the current XPathNavigator is at the same position as the specified XPathNavigator.

LookupNamespace(String) LookupNamespace(String) LookupNamespace(String) LookupNamespace(String)

Gets the namespace URI for the specified prefix.

LookupPrefix(String) LookupPrefix(String) LookupPrefix(String) LookupPrefix(String)

Gets the prefix declared for the specified namespace URI.

Matches(String) Matches(String) Matches(String) Matches(String)

Determines whether the current node matches the specified XPath expression.

Matches(XPathExpression) Matches(XPathExpression) Matches(XPathExpression) Matches(XPathExpression)

Determines whether the current node matches the specified XPathExpression.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MoveTo(XPathNavigator) MoveTo(XPathNavigator) MoveTo(XPathNavigator) MoveTo(XPathNavigator)

When overridden in a derived class, moves the XPathNavigator to the same position as the specified XPathNavigator.

MoveToAttribute(String, String) MoveToAttribute(String, String) MoveToAttribute(String, String) MoveToAttribute(String, String)

Moves the XPathNavigator to the attribute with the matching local name and namespace URI.

MoveToChild(String, String) MoveToChild(String, String) MoveToChild(String, String) MoveToChild(String, String)

Moves the XPathNavigator to the child node with the local name and namespace URI specified.

MoveToChild(XPathNodeType) MoveToChild(XPathNodeType) MoveToChild(XPathNodeType) MoveToChild(XPathNodeType)

Moves the XPathNavigator to the child node of the XPathNodeType specified.

MoveToFirst() MoveToFirst() MoveToFirst() MoveToFirst()

Moves the XPathNavigator to the first sibling node of the current node.

MoveToFirstAttribute() MoveToFirstAttribute() MoveToFirstAttribute() MoveToFirstAttribute()

When overridden in a derived class, moves the XPathNavigator to the first attribute of the current node.

MoveToFirstChild() MoveToFirstChild() MoveToFirstChild() MoveToFirstChild()

When overridden in a derived class, moves the XPathNavigator to the first child node of the current node.

MoveToFirstNamespace() MoveToFirstNamespace() MoveToFirstNamespace() MoveToFirstNamespace()

Moves the XPathNavigator to first namespace node of the current node.

MoveToFirstNamespace(XPathNamespaceScope) MoveToFirstNamespace(XPathNamespaceScope) MoveToFirstNamespace(XPathNamespaceScope) MoveToFirstNamespace(XPathNamespaceScope)

When overridden in a derived class, moves the XPathNavigator to the first namespace node that matches the XPathNamespaceScope specified.

MoveToFollowing(String, String) MoveToFollowing(String, String) MoveToFollowing(String, String) MoveToFollowing(String, String)

Moves the XPathNavigator to the element with the local name and namespace URI specified in document order.

MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator) 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.

MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType)

Moves the XPathNavigator to the following element of the XPathNodeType specified in document order.

MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator)

Moves the XPathNavigator to the following element of the XPathNodeType specified, to the boundary specified, in document order.

MoveToId(String) MoveToId(String) MoveToId(String) MoveToId(String)

When overridden in a derived class, moves to the node that has an attribute of type ID whose value matches the specified String.

MoveToNamespace(String) MoveToNamespace(String) MoveToNamespace(String) MoveToNamespace(String)

Moves the XPathNavigator to the namespace node with the specified namespace prefix.

MoveToNext() MoveToNext() MoveToNext() MoveToNext()

When overridden in a derived class, moves the XPathNavigator to the next sibling node of the current node.

MoveToNext(String, String) MoveToNext(String, String) MoveToNext(String, String) MoveToNext(String, String)

Moves the XPathNavigator to the next sibling node with the local name and namespace URI specified.

MoveToNext(XPathNodeType) MoveToNext(XPathNodeType) MoveToNext(XPathNodeType) MoveToNext(XPathNodeType)

Moves the XPathNavigator to the next sibling node of the current node that matches the XPathNodeType specified.

MoveToNextAttribute() MoveToNextAttribute() MoveToNextAttribute() MoveToNextAttribute()

When overridden in a derived class, moves the XPathNavigator to the next attribute.

MoveToNextNamespace() MoveToNextNamespace() MoveToNextNamespace() MoveToNextNamespace()

Moves the XPathNavigator to the next namespace node.

MoveToNextNamespace(XPathNamespaceScope) MoveToNextNamespace(XPathNamespaceScope) MoveToNextNamespace(XPathNamespaceScope) MoveToNextNamespace(XPathNamespaceScope)

When overridden in a derived class, moves the XPathNavigator to the next namespace node matching the XPathNamespaceScope specified.

MoveToParent() MoveToParent() MoveToParent() MoveToParent()

When overridden in a derived class, moves the XPathNavigator to the parent node of the current node.

MoveToPrevious() MoveToPrevious() MoveToPrevious() MoveToPrevious()

When overridden in a derived class, moves the XPathNavigator to the previous sibling node of the current node.

MoveToRoot() MoveToRoot() MoveToRoot() MoveToRoot()

Moves the XPathNavigator to the root node that the current node belongs to.

PrependChild() PrependChild() PrependChild() 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.

PrependChild(String) PrependChild(String) PrependChild(String) 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.

PrependChild(XmlReader) PrependChild(XmlReader) PrependChild(XmlReader) 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.

PrependChild(XPathNavigator) PrependChild(XPathNavigator) PrependChild(XPathNavigator) 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.

PrependChildElement(String, String, String, String) PrependChildElement(String, String, String, String) PrependChildElement(String, String, String, String) PrependChildElement(String, String, String, String)

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.

ReadSubtree() ReadSubtree() ReadSubtree() ReadSubtree()

Returns an XmlReader object that contains the current node and its child nodes.

ReplaceRange(XPathNavigator) ReplaceRange(XPathNavigator) ReplaceRange(XPathNavigator) ReplaceRange(XPathNavigator)

Replaces a range of sibling nodes from the current node to the node specified.

ReplaceSelf(String) ReplaceSelf(String) ReplaceSelf(String) ReplaceSelf(String)

Replaces the current node with the content of the string specified.

ReplaceSelf(XmlReader) ReplaceSelf(XmlReader) ReplaceSelf(XmlReader) ReplaceSelf(XmlReader)

Replaces the current node with the contents of the XmlReader object specified.

ReplaceSelf(XPathNavigator) ReplaceSelf(XPathNavigator) ReplaceSelf(XPathNavigator) ReplaceSelf(XPathNavigator)

Replaces the current node with the contents of the XPathNavigator object specified.

Select(String) Select(String) Select(String) Select(String)

Selects a node set, using the specified XPath expression.

Select(String, IXmlNamespaceResolver) Select(String, IXmlNamespaceResolver) Select(String, IXmlNamespaceResolver) Select(String, IXmlNamespaceResolver)

Selects a node set using the specified XPath expression with the IXmlNamespaceResolver object specified to resolve namespace prefixes.

Select(XPathExpression) Select(XPathExpression) Select(XPathExpression) Select(XPathExpression)

Selects a node set using the specified XPathExpression.

SelectAncestors(String, String, Boolean) SelectAncestors(String, String, Boolean) SelectAncestors(String, String, Boolean) SelectAncestors(String, String, Boolean)

Selects all the ancestor nodes of the current node that have the specified local name and namespace URI.

SelectAncestors(XPathNodeType, Boolean) SelectAncestors(XPathNodeType, Boolean) SelectAncestors(XPathNodeType, Boolean) SelectAncestors(XPathNodeType, Boolean)

Selects all the ancestor nodes of the current node that have a matching XPathNodeType.

SelectChildren(String, String) SelectChildren(String, String) SelectChildren(String, String) SelectChildren(String, String)

Selects all the child nodes of the current node that have the local name and namespace URI specified.

SelectChildren(XPathNodeType) SelectChildren(XPathNodeType) SelectChildren(XPathNodeType) SelectChildren(XPathNodeType)

Selects all the child nodes of the current node that have the matching XPathNodeType.

SelectDescendants(String, String, Boolean) SelectDescendants(String, String, Boolean) SelectDescendants(String, String, Boolean) SelectDescendants(String, String, Boolean)

Selects all the descendant nodes of the current node with the local name and namespace URI specified.

SelectDescendants(XPathNodeType, Boolean) SelectDescendants(XPathNodeType, Boolean) SelectDescendants(XPathNodeType, Boolean) SelectDescendants(XPathNodeType, Boolean)

Selects all the descendant nodes of the current node that have a matching XPathNodeType.

SelectSingleNode(String) SelectSingleNode(String) SelectSingleNode(String) SelectSingleNode(String)

Selects a single node in the XPathNavigator using the specified XPath query.

SelectSingleNode(String, IXmlNamespaceResolver) SelectSingleNode(String, IXmlNamespaceResolver) SelectSingleNode(String, IXmlNamespaceResolver) 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.

SelectSingleNode(XPathExpression) SelectSingleNode(XPathExpression) SelectSingleNode(XPathExpression) SelectSingleNode(XPathExpression)

Selects a single node in the XPathNavigator using the specified XPathExpression object.

SetTypedValue(Object) SetTypedValue(Object) SetTypedValue(Object) SetTypedValue(Object)

Sets the typed value of the current node.

SetValue(String) SetValue(String) SetValue(String) SetValue(String)

Sets the value of the current node.

ToString() ToString() ToString() ToString()

Gets the text value of the current node.

ValueAs(Type, IXmlNamespaceResolver) ValueAs(Type, IXmlNamespaceResolver) ValueAs(Type, IXmlNamespaceResolver) ValueAs(Type, IXmlNamespaceResolver)

Gets the current node's value as the Type specified, using the IXmlNamespaceResolver object specified to resolve namespace prefixes.

WriteSubtree(XmlWriter) WriteSubtree(XmlWriter) WriteSubtree(XmlWriter) WriteSubtree(XmlWriter)

Streams the current node and its child nodes to the XmlWriter object specified.

Explicit Interface Implementations

ICloneable.Clone() ICloneable.Clone() ICloneable.Clone() ICloneable.Clone()

Creates a new copy of the XPathNavigator object.

Applies to

See Also