Changes select nodes to return an XMLDOMSelection object. The returned object inherits the threading model of the document object.
Set objXMLDOMSelection = objXMLDOMDocument2.selectNodes(strExpr)
Dim xmldoc As New MSXML2.DOMDocument
Dim selection As MSXML2.IXMLDOMSelection
xmldoc.loadXML ("<Customer><Name>Microsoft</Name></Customer>")
xmldoc.setProperty "SelectionLanguage", "XPath"
Set selection = xmldoc.selectNodes("Customer/Name")
MsgBox selection.expr + " -- " + selection.Item(0).xml
The above message box displays "Customer/Name -- <Name>Microsoft</Name>"
selection.expr = "/Customer" MsgBox selection.expr + " -- " + selection.Item(0).xml
The above message box displays "/Customer –-<Customer><Name>Microsoft</Name></Customer>"
Applies To: XMLDOMDocument2 Object