i build an XML
<?xml version="1.0" encoding='UTF-8'?><!DOCTYPE note [
<!ELEMENT note (to*,from*,heading*,body*)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to> Tove </to>
<from> Jani </from>
<heading> Reminder </heading>
<body> Dont forget me this weekend </body>
</note>
and i need to load this file Using Javascript i write this script
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>haaaaaaaa</title>
<script language="JavaScript" type="text/javascript">
function getdata()
{
if(window.XMLHttpRequst)
{
var xhttp=new xmlHttpRequest();
}
else
{
var xhttp=new ActiveXObject("Microsoft.XMLHTTP")
}
xhttp.open("GET","note.xml",false);
xhttp.send();
var xmlDoc=xhttp.responseXML;
if (xhttp.readyState == 4)
{
alert(xmlDoc.parseError);
alert(xmlDoc.readyState);
alert(xmlDoc.getElementsByTagName("from")(0));
}
document.write(xmlDoc.getElementsByTagName("to")[0].childNodes[0].noteValue);
}
</script>
</head>
<body onload="getdata()">
<h1>w3schools</h1>
<b>To:</b>
<span id="to"></span>
</body>
</html>
the problem is when i run this script the alert "alert(xmlDoc.getElementsByTagName("to")(0));" give me Null that mean i can't get the value i don't know why and i search alot but didn't find any thing