Copy Code code as follows:
reading XML files
function Loadxml (xmlFile) {
var xmldoc;
if (window. ActiveXObject) {
xmldoc = new ActiveXObject ("Microsoft.XMLDOM");
Xmldoc.async = false;
Xmldoc.load (XmlFile);
}
else if (document.implementation && document.implementation.createDocument) {
xmldoc = Document.implementation.createDocument ("", "", null);
Xmldoc.async = false;
Xmldoc.load (XmlFile);
} else {
Alert (' Your browser does not support this system script! ');
}
return xmldoc;
}
Output XML file
function Outxml (filename) {
var xmldoc = loadxml (filename);
var x = Xmldoc.getelementsbytagname ("Properties");
var text=x[0].outerhtml.replace (/</g, "<");
return text;
}
function Dirxml (xmldoc) {
var entry=xmldoc.getelementsbytagname ("Properties") [0].getelementsbytagname ("entry");
for (var i=0,j=entry.length; i<j;i++) {
Console.log (Entry[i].getattribute ("key"));
Console.log (Entry[i].childnodes[0].nodevalue);
}
}