Export (0) Print
Expand All
DOM
Expand Minimize

removeAll Method

Removes all the nodes from the collection described by the IXMLDOMSelection.

objXMLDOMSelection.removeAll();

Example

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
var oSelection;
xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false;
xmlDoc.loadXML("<root><child/><child/><child/></root>");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   WScript.Echo("Before removing <child> nodes:\n" + xmlDoc.xml + "\n");
   oSelection = xmlDoc.selectNodes("//child");
   oSelection.removeAll();
   WScript.Echo("After removing <child> nodes:\n" + xmlDoc.xml + "\n");
}


This example outputs the books.xml file.

HRESULT removeAll();

Return Values

S_OK

The value returned if the method is successful.

E_PENDING

The value returned if all nodes cannot be found at this time (in which case no nodes are removed).

Implemented in: MSXML 3.0 and MSXML 6.0

Show:
© 2014 Microsoft