Ajax access. Do or. JSP, etc. see more, today see the access to XML files.
var url = "Myxml.xml"; URL points to an XML file path
Createxmlhttprequest ();
Xmlhttpreq.onreadystatechange = ProcessResponse;
Xmlhttpreq.open ("Get", url,true);
Xmlhttpreq.send (NULL);
XML file Format:
<?xml version= "1.0" encoding= "GB2312"?>
<classmates>
<student>
<sid>1</sid>
<sname>reqe</sname>
<gre>1700</gre>
<tse>120</tse>
</student>
<student>
<sid>2</sid>
<sname>rqerwe</sname>
<gre>1800</gre>
<tse>120</tse>
</student>
<student>
<sid>3</sid>
<sname>iuir</sname>
<gre>1700</gre>
<tse>120</tse>
</student>
</classmates>
Parsing: var students = XMLHttpReq.responseXML.getElementsByTagName ("student"); Get all the student node sets
for (var i =0;i<students.length;i++)
{
var stud = Students[i]; Get a stutdent knot.
var name = Stud.getelementsbytagname ("sname") [0].firstchild.data; Take the data from the node.
var gre = stud.getelementsbytagname ("GRE") [0].firstchild.data;
var tse = Stud.getelementsbytagname ("TSE") [0].firstchild.data;
}