hi
I am trying to get xml values into javascript I have been trying to get xml values through javascript and it is working fine in IE but not in firefox.
here are the javascript code
my xml file is, "valid.xml"
The above code is working fine with IE .I also tried to work with firefox with these code
xmlreq =document.imple mentation.creat eDocument("","" ,null);
but after load,
xmlreq.load(xml File);
var xmlDoc =xmlreq.documen tElement;
if i alert xmlDoc
it gives null , and error is xmldoc has no properties.plea se help me
I am trying to get xml values into javascript I have been trying to get xml values through javascript and it is working fine in IE but not in firefox.
here are the javascript code
Code:
var xmlreq = false;
//xmlreq =document.implementation.createDocument("","",null);
xmlreq = new ActiveXObject("Microsoft.XMLDOM");
var xmlFile="/val/valid.xml";
var vale="";
xmlreq.async="false";
xmlreq.onreadystatechange=verify();
xmlreq.load(xmlFile);
var xmlDoc =xmlreq.documentElement;
vale=xmlDoc.getElementsByTagName('firstcheck')[0].firstChild.nodeValue;
// i need to get the values from xml to this variable "vale"
function verify() {
if (xmlreq.readyState != 4) {
return false;
}
alert(xmlreq.readyState);
}
Code:
<?xml version="1.0" encoding="UTF-8"?> <validationcheck> <firstcheck>check</firstcheck> <firstcheck>venki</firstcheck> </validationcheck>
xmlreq =document.imple mentation.creat eDocument("","" ,null);
but after load,
xmlreq.load(xml File);
var xmlDoc =xmlreq.documen tElement;
if i alert xmlDoc
it gives null , and error is xmldoc has no properties.plea se help me
Comment