I am doing is reading xml document from server and i have to make modification to that xml document locally and store the xml document response on server but i am not able to print the changed xml response please help me!!!!
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send();
return xhttp.responseXML;
}
function stringsxmlparsing()
{
console.log("\n\nThis is books.xml demo\n\n");
xmlDoc=loadXMLDoc("books.xml");
//Changing attribute value
x=xmlDoc.getElementsByTagName('string');
x[0].setAttribute("name","food");
//Accessing attribute value
txt=xmlDoc.getElementsByTagName("string")[0].getAttribute("name");
console.log("getAttribute value :"+txt
//here i have to send response xml to server
//I have tried
//console.log(xmlDoc.toXMLString()) but won't worked
}
No comments:
Post a Comment