Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes.
Syntax
objXMLDOMNodeList = oXMLDOMNode.selectNodes(patternString)
Parameters
patternString
String specifying the XSL Pattern query that is to be applied to the context defined by this node.
Returns
Object. Returns a list of nodes selected by the XSL Pattern query. If no nodes are selected, an empty node list is returned.
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.
The XMLDOMNodeList object is live and immediately reflects changes to the nodes that appear in the list.
This member is an extension of the W3C DOM.
Example
The following example creates an XMLDOMNodeList object containing the nodes specified by the pattern string (i.e., all of the "Author" child nodes with a "Book" parent). It then displays the number of nodes contained in the node list:
Dim xmlDoc
Dim nodeList
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set nodeList = xmlDoc.documentElement.selectNodes("BOOK/AUTHOR")
MsgBox nodeList.length
Applies To
XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime
See Also