i am using below code to traverse xml in javascript i am able to get value using x[i].childNodes[0].text; function in IE but not in firefox. please tell me what should i use so that it work with all.
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 loadxml() {
var xmlDoc = loadXMLDoc("xmldata/wfc20100915.xml");
// documentElement always represents the root node
x = xmlDoc.documentElement.childNodes;
var arr = new Array();
var str = "";
for (i = 0; i < x.length; i++) {
if (x[i].childNodes.length > 3) {
arr[i] = new Array(5);
arr[i][0] = x[i].childNodes[0].text;
arr[i][1] = x[i].childNodes[1].text;
arr[i][2] = x[i].childNodes[2].text;
arr[i][3] = x[i].childNodes[3].text;
arr[i][4] = x[i].childNodes[4].text;