Microsoft XML 2.5 SDK


 

selectSingleNode Method

[This is preliminary documentation and subject to change.]

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

Syntax

objXMLDOMNode = oXMLDOMNode.selectSingleNode(patternString)

Parameters

patternString

String specifying the XSL Pattern query that is to be applied to the context defined by this node.

Returns

Object. Returns the first node that matches the XSL Pattern query. If no nodes match the query, it returns NULL.

Remarks

For a complete description, see the XSL Pattern 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.

This member is an extension of the W3C DOM.

Example

The following example creates an XMLDOMNode object and sets it to the first instance of an "Author" node with a "Book" parent, then displays the text of the node:

Dim xmlDoc
Dim currNode
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set currNode = xmlDoc.documentElement.selectSingleNode("BOOK/AUTHOR")
MsgBox currNode.text

Applies To

XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime

See Also

Using the XSL Processor