Applies the specified pattern-matching operation to this node's context and returns the first matching node.
objXMLDOMNode = oXMLDOMNode.selectSingleNode(patternString)
Object. Returns the first node that matches the XSL or XPath query. If no nodes match the query, it returns Null.
For a complete description of XSL Syntax, see XSL Pattern Syntax.
For a complete description of XPath syntax, see XPath Syntax.
The selectSingleNode method is much like the selectNodes method but returns only the first matching node rather than the list of all matching nodes.
This member is an extension of the W3C DOM.
The following VBScript example creates an XMLDOMNode object and sets it to the first instance of an AUTHOR node with a BOOK parent. It then displays the text of the node:
Dim xmlDoc Dim currNode Set xmlDoc = CreateObject("Msxml2.DOMDocument") xmlDoc.async = False xmlDoc.load("c:\books.xml") Set currNode = xmlDoc.documentElement.selectSingleNode("BOOK/AUTHOR") MsgBox currNode.text
Applies To: XMLDOMAttribute Object | XMLDOMCDATASection Object | XMLDOMCharacterData Object | XMLDOMComment Object | DOMDocument Object | XMLDOMDocumentFragment Object | XMLDOMDocumentType Object | XMLDOMElement Object | XMLDOMEntity Object | XMLDOMEntityReference Object | XMLDOMNode Object | XMLDOMNotation Object | XMLDOMProcessingInstruction Object | XMLDOMText Object | XTLRuntime Object