3
Jitendra,
Send below things
- Javascript you wrote.
- Error message you are getting.
- XML, if it's diffre from what u sent early
Because exact same code working without any roblem here :)
Accepted 0
Hi Dear,
Sorry to late replay.
you code is perfectly working.
It's my mistake.
Thanks a lots to solved my problem.
Thanks,
Jitendra Patel
0
hi,
I have used both but it is not working
xmlDoc.onreadystatechange
= verify;
and
xmlDoc.onreadystatechange
= verify();
after complete this line then print this
alert(xmlDoc.onreadystatechange);
than errors.
Still it is not working.
0
Hi,
xmlDoc.onreadystatechange = verify();
is wrong
xmlDoc.onreadystatechange = verify;
We are assigning the Ref. not value. I got xmlDocElement too with your XML. Let me know the updates.
0
Hi,
this function is not working.....
onreadystatechange()
than jQuery errors,
xmlDoc.onreadystatechange = verify();
0
<?xml version="1.0" encoding="utf-8" ?>
<Validation>
<Validationtype>
<Text>Please Enter field.</Text>
<Numeric>Please Enter Only Numeric value in field.</Numeric>
</Validationtype>
</Validation>
0
I am doubting your XML format. Send ur XML
0
hi,
when I use above code than
in Loadxml function
var xmlDocElement = xmlDoc.documentElement;
xmlDocElement is null.
it's value is not get........
Thanks,
Jitenra Patel
0
Hi,
Try this way. I am not sure where the road block is?
XML Used
<?xml version="1.0" ?>
<employees>
<employee id="1" g="M">Jaish</employee>
<employee id="2" g="M">KD</employee>
<employee id="3" g="M">Aji</employee>
</employees>
Code
<script language="javascript" type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function pageLoad()
{
loadxml("E:\\JAISH\\Validation.xml");
}
function loadxml(xmlFile)
{
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
var xmlDocElement=xmlDoc.documentElement;
alert(xmlDocElement.xml);
var gender = xmlDocElement.childNodes(0).attributes[1].value;
alert(gender);
var name = xmlDocElement.childNodes(0).text
alert(name)
}
//This is call back for any errors
function verify()
{
// 0 Object is not initialized
// 1 Loading object is loading data
// 2 Loaded object has loaded data
// 3 Data from object can be worked with
// 4 Object completely initialized
if (xmlDoc.readyState != 4)
{
return false;
}
}
</script>