Gets the next node that the nextNode
method will return without advancing the list position.
var objXMLDOMNode = objXMLDOMSelection.peekNode();
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var oSelection, nodeBook; 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 { oSelection = xmlDoc.selectNodes("//book"); nodeBook = oSelection.peekNode(); alert(nodeBook.xml); }
Set objXMLDOMNode = objXMLDOMSelection.peekNode
Dim xmlDoc As New Msxml2.DOMDocument50 Dim oSelection As IXMLDOMSelection Dim nodeBook As IXMLDOMElement 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 oSelection = xmlDoc.selectNodes("//book") Set nodeBook = oSelection.peekNode() MsgBox nodeBook.xml End If
HRESULT peekNode (IXMLDOMNode** ppNode);
Like nextNode
, peekNode
does not result in a snapshot of all matching nodes. Consecutive calls to peekNode
will produce the same node over and over, independent of changes in the underlying tree.
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