次の方法で共有


removeAll Method

 

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

JScript Syntax

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.

C/C++ Syntax

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).

Versioning

Implemented in: MSXML 3.0 and MSXML 6.0

Applies to

IXMLDOMSelection