removeChild Method
Removes the specified child node from the list of children and returns it.
var objXMLDOMNode = oXMLDOMNode.removeChild(childNode);
Parameters
Return Value
An object. Returns the removed child node.
Example
The following script example creates an IXMLDOMNode object (currNode), removes a child node from it, and displays the text of the removed node.
Note |
|---|
You can use books.xml to run this sample code. |
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0"); var root; var currNode; var oldChild; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode != 0) { var myErr = xmlDoc.parseError; WScript.Echo("You have error " + myErr.reason); } else { root = xmlDoc.documentElement; currNode = root.childNodes.item(1); oldChild = currNode.removeChild(currNode.childNodes.item(1)); WScript.Echo(oldChild.text); }
Output
Midnight Rain
Note