How to update Xml file using javascript.
Hi,
I have requirement to update xml file locally javascript.
The html file and xml file are in same directory and i want to update the xml file thrgh html file.
Note: I am reading it through undermention script method:
function loadXMLDoc(dname) {
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else {
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
//alert(xhttp);
xhttp.open("GET", 'abc.xml', false);
xhttp.send(null);
return xhttp.responseXML;
}
Now i to edit and update the xml :
function doSubmit(){
xmlDoc = loadXMLDoc("abc.xml");
var len = xmlDoc.getElementsByTagName("original").length;
if( (-1 < currentRow) && (currentRow < len) ) {
alert(document.controlForm.notes.value);
xmlDoc.getElementsByTagName("notes")
[currentRow].childNodes[0].nodeValue = "zuni";
xmlDoc.save("abc.xml");
}
}
But it is not updating the local xml file.
Please help me out ?
how to update xml thrgh javaScript.
I am totally stucked?
Thanks,
Zuned
|