topical media & game development
basic-xml-11-DeleteNode.htm / htm
<html>
<head>
<title>Delete a child node.</title>
</head>
<body>
<script language="JScript" type="text/javascript">
try {
var strXML = "<?xml version='1.0' ?><Book><Chapter>This is Chapter 1.</Chapter><Chapter>This is Chapter 2.</Chapter><Chapter>This is Chapter 3.</Chapter></Book>"
var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument.3.0");
objXMLDOM.loadXML(strXML);
alert(objXMLDOM.xml);
var objToBeDeleted = objXMLDOM.documentElement.firstChild;
alert(objToBeDeleted.firstChild.nodeValue);
objXMLDOM.documentElement.removeChild(objToBeDeleted);
alert(objXMLDOM.xml);
}
catch (e)
{
alert("An exception has occurred.");
}
</script>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.