XPathNavigatorExtensions.XPathSelectSingleNode Method (XPathNavigator, string, IXmlNamespaceResolver)XPathNavigatorExtensions.XPathSelectSingleNode Method (XPathNavigator, String, IXmlNamespaceResolver)XPathNavigatorExtensions::XPathSelectSingleNode Method (XPathNavigator^, String^, IXmlNamespaceResolver^)

Evaluates the specified XPath 2.0 expression to select a single node.

Syntax

Public Shared Function XPathSelectSingleNode( _
    navigator As System.Xml.XPath.XPathNavigator, _
    expression As String, _
    resolver As System.Xml.IXmlNamespaceResolver _
) As System.Xml.XPath.XPathNavigator
public static System.Xml.XPath.XPathNavigator XPathSelectSingleNode(
    System.Xml.XPath.XPathNavigator navigator,
    string expression,
    System.Xml.IXmlNamespaceResolver resolver
)
public:
static System.Xml.XPath::XPathNavigator^ XPathSelectSingleNode(
    System.Xml.XPath::XPathNavigator^ navigator, 
    String^ expression, 
    System.Xml::IXmlNamespaceResolver^ resolver
)
 

Return Value

Type: System.Xml.XPath.XPathNavigatorSystem.Xml.XPath.XPathNavigatorSystem.Xml.XPath::XPathNavigator^

The result of the evaluating the XPath 2.0 expression specified; otherwise, null a null reference (Nothing in Visual Basic) nullptr if there are no query results.

Exceptions

ExceptionCondition
ArgumentNullExceptionArgumentNullExceptionArgumentNullExceptionexpression is null a null reference (Nothing in Visual Basic) nullptr or resolver is null a null reference (Nothing in Visual Basic) nullptr.
XdmExceptionXdmExceptionXdmExceptionAn error occurred compiling or evaluating the XPath 2.0 expression.
InvalidCastExceptionInvalidCastExceptionInvalidCastExceptionThe return type was an item which was not a node.
XdmExceptionXdmExceptionXdmExceptionAn error occurred compiling or evaluating the XPath 2.0 expression.

Remarks

If the XPath 2.0 expression returns more than one node the first node is returned.