Checks if the node that is passed is contained in the current collection.
objXMLDOMNode = objXMLDOMSelection.matches(objXMLDOMNode);
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var oSelection, nodeBook, node; xmlDoc.setProperty("SelectionLanguage", "XPath"); xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { nodeBook = xmlDoc.selectSingleNode("//book"); oSelection = xmlDoc.selectNodes("//*"); node = oSelection.matches(nodeBook); alert(node.xml); }
objXMLDOMNode = objXMLDOMSelection.matches(objXMLDOMNode)
Dim xmlDoc As New Msxml2.DOMDocument50 Dim oSelection As IXMLDOMSelection Dim nodeBook As IXMLDOMNode Dim node As IXMLDOMNode xmlDoc.setProperty "SelectionLanguage", "XPath" xmlDoc.async = False xmlDoc.Load "books.xml" If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else Set nodeBook = xmlDoc.selectSingleNode("//book") Set oSelection = xmlDoc.selectNodes("//*") Set node = oSelection.matches(nodeBook) MsgBox node.xml End If
HRESULT matches(IXMLDOMNode* pNode, IXMLDOMNode** ppNode);
pNode
parameter is Null.
An error for cases that are not allowed, as outlined in the Extensible Stylesheet Language (XSL) specification (applied to ID, IDREF, and Ancestor).
When matches
is called with node A, it returns node B such that if B was set as the context on a query, A is in the result set of the query. If no such B node is found, matches
returns Null.
The matches
method does not take into account the current context of the query.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
Applies to: IXMLDOMSelection