removeAll Method

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

removeAll Method

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

[Script]

Script Syntax

objXMLDOMSelection.removeAll();

Example

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 {
   alert(xmlDoc.xml);
   oSelection = xmlDoc.selectNodes("//book");
   oSelection.removeAll();
   alert(xmlDoc.xml);
}
[Visual Basic]

Visual Basic Syntax

objXMLDOMSelection.removeAll

Example

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
   MsgBox xmlDoc.xml
   Set oSelection = xmlDoc.selectNodes("//book")
   oSelection.removeAll
   MsgBox xmlDoc.xml
End If
[C/C++]

C/C++ Syntax

HRESULT removeAll();

C/C++ 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).

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Applies to: IXMLDOMSelection