Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as an XMLDOMNodeList object.
objXMLDOMNodeList = oXMLDOMNode.selectNodes(patternString)
Object. Returns a collection of nodes selected by an XSL or XPath query. If no nodes are selected, an empty collection is returned.
For a complete description of XSL Syntax, see XSL Pattern Syntax.
For a description of XPath sytax, 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.
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.
The following VBScript 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("Msxml2.DOMDocument") xmlDoc.async = False xmlDoc.load("c:\books.xml") Set objNodeList = xmlDoc.documentElement.selectNodes("BOOK/AUTHOR") MsgBox objNodeList.length
Using the XSLT Processor | Using Collections
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