<html>
<head>
<script type="text/javascript" src="/example/xdom/loadxmldoc.js">
</script>
</head>
<body>
<script type="text/javascript">
xmlDoc=loadXMLDoc("/example/xdom/books.xml");
var newel=xmlDoc.createElement('edition');
var newtext=xmlDoc.createTextNode('First');
newel.appendChild(newtext);
var x=xmlDoc.getElementsByTagName('book')[0];
x.appendChild(newel);
var y=x.childNodes;
for (var i=0;i<y.length;i++)
{
if (y[i].nodeType==1)
{
document.write(y[i].nodeName);
document.write("<br />");
}
}
</script>
</body>
</html>