The following is a versatile
ActiveXObject
that generates and processes xml
function loadXMLDoc(dname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
Then you can use xmlDoc.
For example:
xmlDoc=loadXMLDoc("books.xml");
var x=xmlDoc.getElementsByTagName('book');
var newel
for (i=0;i<x.length;i++)
{
newel=xmlDoc.createElement('edition');
x[i].appendChild(newel);
}
Add and delete node attributes, etc.