topical media & game development
basic-xml-11-Whitespace.htm / htm
<html>
<head>
<title>Child Nodes and Whitespace Example</title>
<script>
function showChildNodes(){
var strDisplay = "";
var objDocElem = objXMLDOM.documentElement;
strDisplay += "There are " + objXMLDOM.documentElement.childNodes.length + " child nodes of the " + objXMLDOM.documentElement.nodeName + " element.\n";
for (i=0; i<objXMLDOM.documentElement.childNodes.length; i++)
{
strDisplay += "The name of the child node in position " + i + " is " + objDocElem.childNodes.item(i).nodeName + "\n";
} // end for loop
alert(strDisplay);
}
</script>
</head>
<body>
<p>Text nodes and the childNodes property.</p>
<script language="JScript" type="text/javascript">
try {
var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument.3.0");
objXMLDOM.load("c:\\BXML\\Ch11\\Book.xml");
}
catch (e)
{
document.write("An exception was raised.");
}
</script>
<br />
<input type="button" value="Click here to show XML information"
onclick="showChildNodes()" />
</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.