Click to See Complete Forum and Search --> : adding nodes in xml using javascript


karang
February 28th, 2007, 06:55 AM
HI

I am having the xml file with structure
<class></class>

to add a node <name> in the class I am using the code

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("class.xml");
var x=xmlDoc.getElementsByTagName("class");
var newel;
for (i=0;i<x.length;i++)
{
newel=xmlDoc.createElement("name");
x[i].appendChild(newel);
var XML = new xmlWriter();
//xmlDoc.save("class.xml");
}

But it is not doing anything.

But while I uncomment the line xmlDoc.save("class.xml");

then the error occurs "Permission denied"


Please tell me where I am going wrong

Regards
Karan