Microsoft XML SDK 2.6 - XML Reference

IXMLDOMNode::selectSingleNode Method

Applies the specified pattern to this node's context and returns the first matching node.

Visual Basic Syntax

Set objXMLDOMNode = oXMLDOMNode.selectSingleNode(patternString)

C/C++ Syntax

HRESULT selectSingleNode(
    BSTR patternString,
    IXMLDOMNode **resultNode);

Parameters

patternString [in]
String specifying the XSL or XPath query that is to be applied to the context defined by this node. Whether an XSL or XPath query is used is determined by the value of the SelectionLanguage property. By default, the expression is an XSL pattern query. The SelectionLanguage property can be set with the SetProperty method.
resultNode [out]
First node that is selected by the XPath query. If no nodes result from the query, it returns Null.

C/C++ Return Values

S_OK
Value returned if successful.
S_FALSE
Value returned if there is no match.
E_INVALIDARG
Value returned if resultNode is Null.

Remarks

For a complete description of XPath, see the XPath Syntax reference.

The selectSingleNode method is much like the selectNodes method but returns only the first matching node rather than the list of all matching nodes.

See Also

IXMLDOMNode Interface | Using the XSLT Processor