How to modify XML-file info and save

141 views Asked by At

So, I need to get the information from the nodes, modify it and then save the file with the new information. Later on I will first take in the existing node value as the value of an input-field. The user should then be able to adjust the value and save the file.

HEAD

<script>
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;
} 
</script>

BODY

<div id="firstdiv" style="background:yellow;color:black;width:300px;height:200px;"></div>
<div id="seconddiv" style="background:green;color:black;width:300px;height:200px;"></div>
<script>
xmlDoc=loadXMLDoc("example.xml");

x=xmlDoc.getElementsByTagName("MAN")[0].childNodes[0];
document.getElementById("firstdiv").innerHTML=x.nodeValue;
x.nodeValue="1";
document.getElementById("seconddiv").innerHTML=x.nodeValue;
</script>
0

There are 0 answers