First, establish an XML object:
Var myxml = new xml ();
Second, the reference XML file:
MyXml.Load ("DATA.XML");
Third, ignore spaces:
MyXML.IgnoreWhite = true; // default for false
Functions to process XML objects: myXml.onload = function (success) {statements;} 5, data.xml file content:
2, myXml.childNodes [0] .NodeName will return:
Data1
3, myXml.childnodes [0] .childnodes [0] .name will return:
ImageBear
4, myxml.childnodes [0] .childNodes [0] will return:
xiaoshandong
data2>
5, myxml.childnodes [0] .childnodes [0] .NodeName will return:
Data2
6, myxml.childnodes [0] .childnodes [1] .attributes.name will return:
Mariger3
7, myXml.childnodes [0] .childnodes [0] .childnodes [0] .NodeValue will return:
xiaoshandong
8, var myname = myXml.firstchild.firstchild;
Trace (MyName.NodeName); will output DATA2
MyName = myname.nextsibling;
TRACE (MyName.NodeName); Data3ChildNodes [0] is equivalent to firstchild