Removes the next node.
var objXMLDOMNode = objXMLDOMSelection.removeNext();
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var oSelection; 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"); while (oSelection.peekNode() != null) { oSelection.removeNext(); } alert(xmlDoc.xml); }
Set objXMLDOMNode = objXMLDOMSelection.removeNext
Dim xmlDoc As New Msxml2.DOMDocument50 Dim oSelection As IXMLDOMSelection 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") While Not (oSelection.peekNode() Is Nothing) oSelection.removeNext Wend MsgBox xmlDoc.xml End If
HRESULT removeNext(IXMLDOMNode ** ppNode);
nextNode
to remove. If the parameter is Null, the removed node is not returned, but is still removed.The removeNext
method is equivalent to the following (except that it also works for attributes).
var node = list.peekNode(); node.parentNode.removeChild(node);
The side effect is that the length of the collection is decremented and the nextNode
and item
methods will not return it because it has been removed.
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