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 ref class XPathNavigator abstract : System::Xml::XPath::XPathItem, System::Xml::IXmlNamespaceResolver, System::Xml::XPath::IXPathNavigable
public ref class XPathNavigator abstract : ICloneable
public abstract class XPathNavigator : System.Xml.XPath.XPathItem, ICloneable, System.Xml.IXmlNamespaceResolver, System.Xml.XPath.IXPathNavigable
public abstract class XPathNavigator : System.Xml.XPath.XPathItem, System.Xml.IXmlNamespaceResolver, System.Xml.XPath.IXPathNavigable
public abstract class XPathNavigator : ICloneable
type XPathNavigator = class
    inherit XPathItem
    interface ICloneable
    interface IXmlNamespaceResolver
    interface IXPathNavigable
type XPathNavigator = class
    inherit XPathItem
    interface IXmlNamespaceResolver
    interface IXPathNavigable
type XPathNavigator = class
    interface ICloneable
type XPathNavigator = class
    inherit XPathItem
    interface ICloneable
    interface IXPathNavigable
    interface IXmlNamespaceResolver
Public MustInherit Class XPathNavigator
Inherits XPathItem
Implements ICloneable, IXmlNamespaceResolver, IXPathNavigable
Public MustInherit Class XPathNavigator
Inherits XPathItem
Implements IXmlNamespaceResolver, IXPathNavigable
Public MustInherit Class XPathNavigator
Implements ICloneable
Inheritance
XPathNavigator
Inheritance
XPathNavigator
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 Implementers

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

Constructors

XPathNavigator()

Initializes a new instance of the XPathNavigator class.

Properties

BaseURI

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

CanEdit

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

HasAttributes

Gets a value that indicates whether the current node has any attributes.

HasChildren

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

InnerXml

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

IsEmptyElement

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

IsNode

Gets a value that indicates if the current node represents an XPath node.

LocalName

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

Name

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

NamespaceURI

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

NameTable

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

NavigatorComparer

Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.

NodeType

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

OuterXml

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

Prefix

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

SchemaInfo

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

TypedValue

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

UnderlyingObject

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

Value

When overridden in a derived class, gets the string value of the item.

Value

When overridden in a derived class, gets the string value of the item.

(Inherited from XPathItem)
ValueAsBoolean

Gets the current node's value as a Boolean.

ValueAsDateTime

Gets the current node's value as a DateTime.

ValueAsDouble

Gets the current node's value as a Double.

ValueAsInt

Gets the current node's value as an Int32.

ValueAsLong

Gets the current node's value as an Int64.

ValueType

Gets the .NET Type of the current node.

XmlLang

Gets the xml:lang scope for the current node.

XmlType

Gets the XmlSchemaType information for the current node.

XmlType

When overridden in a derived class, gets the XmlSchemaType for the item.

(Inherited from XPathItem)

Methods

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)

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)

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)

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)

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)

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

Clone()

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

ComparePosition(XPathNavigator)

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

Compile(String)

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

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

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

CreateNavigator()

Returns a copy of the XPathNavigator.

DeleteRange(XPathNavigator)

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

DeleteSelf()

Deletes the current node and its child nodes.

Equals(Object)

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

(Inherited from Object)
Evaluate(String)

Evaluates the specified XPath expression and returns the typed result.

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)

Evaluates the XPathExpression and returns the typed result.

Evaluate(XPathExpression, XPathNodeIterator)

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

GetAttribute(String, String)

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

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNamespace(String)

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

GetNamespacesInScope(XmlNamespaceScope)

Returns the in-scope namespaces of the current node.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
InsertAfter()

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

InsertAfter(String)

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

InsertAfter(XmlReader)

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

InsertAfter(XPathNavigator)

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

InsertBefore()

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

InsertBefore(String)

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

InsertBefore(XmlReader)

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

InsertBefore(XPathNavigator)

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

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)

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)

Determines whether the specified XPathNavigator is a descendant of the current 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)

Gets the namespace URI for the specified prefix.

LookupPrefix(String)

Gets the prefix declared for the specified namespace URI.

Matches(String)

Determines whether the current node matches the specified XPath expression.

Matches(XPathExpression)

Determines whether the current node matches the specified XPathExpression.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MoveTo(XPathNavigator)

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

MoveToAttribute(String, String)

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

MoveToChild(String, String)

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

MoveToChild(XPathNodeType)

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

MoveToFirst()

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

MoveToFirstAttribute()

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

MoveToFirstChild()

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

MoveToFirstNamespace()

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

MoveToFirstNamespace(XPathNamespaceScope)

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

MoveToFollowing(String, String)

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

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)

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

MoveToFollowing(XPathNodeType, XPathNavigator)

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

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)

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

MoveToNext()

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

MoveToNext(String, String)

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

MoveToNext(XPathNodeType)

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

MoveToNextAttribute()

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

MoveToNextNamespace()

Moves the XPathNavigator to the next namespace node.

MoveToNextNamespace(XPathNamespaceScope)

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

MoveToParent()

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

MoveToPrevious()

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

MoveToRoot()

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

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)

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)

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)

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)

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

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

ReplaceRange(XPathNavigator)

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

ReplaceSelf(String)

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

ReplaceSelf(XmlReader)

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

ReplaceSelf(XPathNavigator)

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

Select(String)

Selects a node set, using the specified XPath expression.

Select(String, IXmlNamespaceResolver)

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

Select(XPathExpression)

Selects a node set using the specified XPathExpression.

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)

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

SelectChildren(String, String)

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

SelectChildren(XPathNodeType)

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

SelectDescendants(String, String, Boolean)

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

SelectDescendants(XPathNodeType, Boolean)

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

SelectSingleNode(String)

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

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)

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

SetTypedValue(Object)

Sets the typed value of the current node.

SetValue(String)

Sets the value of the current node.

ToString()

Gets the text value of the current node.

ValueAs(Type)

Returns the item's value as the specified type.

(Inherited from XPathItem)
ValueAs(Type, IXmlNamespaceResolver)

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

WriteSubtree(XmlWriter)

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

Explicit Interface Implementations

ICloneable.Clone()

Creates a new copy of the XPathNavigator object.

Applies to

See also