System.Xml.XPath.XPathNavigator.SelectSingleNode Method

Selects a single node in the System.Xml.XPath.XPathNavigator object using the specified XPath query with the System.Xml.IXmlNamespaceResolver object specified to resolve namespace prefixes.

Syntax

public virtual XPathNavigator SelectSingleNode (string xpath, System.Xml.IXmlNamespaceResolver resolver)

Parameters

xpath
A string representing an XPath expression.
resolver
The System.Xml.IXmlNamespaceResolver object used to resolve namespace prefixes in the XPath query.

Returns

An System.Xml.XPath.XPathNavigator object that contains the first matching node for the XPath query specified; otherwise null if there are no query results.

Remarks

The XPathNavigator.SelectSingleNode(string, System.Xml.IXmlNamespaceResolver) method selects the first node that matches the XPath query specified. The XPathNavigator.SelectSingleNode(string, System.Xml.IXmlNamespaceResolver) method uses the System.Xml.IXmlNamespaceResolver object to resolve namespace prefixes.

Note:

In XPath all namespaces must be prefixed in a query. If an XML document uses a default namespace, you must still add a namespace prefix to the System.Xml.IXmlNamespaceResolver object.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0