The following is a brief introduction to the tutorial of Flash calling XML data
First, create XML objects:
var myxml= New XML ();
Second, the reference XML file:
Myxml.load("Pro.xml");
Third, ignore the space://The default is False
Myxml.ignoRewhite =True
Iv. Processing XML objectsFunction:
Myxml.onloAD = FunctIon (success) {Statements;}
Five, Pro. XML textThe contents of a piece
<productsName= "Good"><productName= "WelL ">WYU</PROduct><proDuct Name="Better" >wYu2</produCt></produCts>
Six, Test return value 1,Myxml.chilDnodes[0] WillReturn:
<productsName= "Good">
<product NAme= "OK">wyu</prodUct>
<product NAme= "BetteR ">wyu2</pRoduct>
</products>
2, myxml.chIldnodes[0].nodenamewill return:
Good
3, myxml.chIldnodes[0].childnodEs[0].namewill return:
So
4, myxml.chIldnodes[0].childnodEs[0] will return:
<product NAme= "OK">
Wyu
</product>
5, myxml.chIldnodes[0].childnodEs[0].nodeName will return:
So
6, myxml.chIldnodes[0].childnodEs[1].attrIbutes.namE will return:
Better
7, myxml.chIldnodes[0].childnodEs[0].chilDnodes[0].NodeValue willReturn:
Wyu
8,
var myname= MYXML.FIrstchild.FirstChild;
Trace (MynaMe.nodename);//Will output well
MyName = mYname.nextsibling;
Trace (MynaMe.nodename);//Will output beTter ChildNodes[0] EquivalenceIn FirstchilD
Seven, test code
var myxml= New XML ();
Myxml.load("Pro.xml");
Myxml.ignoRewhite =True
Myxml.onloAD = FunctIon (success) {
if (success) {
MyArray =Myxml.chilDnodes[0];
Trace (MyarRay.attribUtes.name);
/*trace (myXml.childnodes[0].chIldnodes[1].firstchiLd.nodevalUE);
Trace (MYXML.firstchiLD);
Trace (MYXML.childnodEs[0].nodeName);
Trace (MYXML.firstchiLd.attribuTes.name);
Trace (MYXML.childnodEs[0].chilDNODES[1].NodeName);
Trace (MYXML.childnodEs[0].chilDNODES[1].Attributes. name);
Trace (MYXML.firstchiLd.firstchILD);
Trace (MYXML.firstchiLd.firstchIld.nodenaME);
Trace (MYXML.firstchiLd.firstchIld.attribUtes.name);
Trace (MYXML.childnodEs[0].chilDnodes[0].ChildNodes[0].nodevaLue);
var myname= MYXML.FIrstchild.FirstChild;
Trace (MynaMe.nodename);
MyName = mYname.nextsibling;
Trace (MynaMe.nodename);
}
};