Hi all, I would like to ask …
How to retrieve the exact XML data in AS3 ??
here is the XML set
<xml>
<group>
<id>1</id>
<item>Item A</item>
</group>
<group>
<id>2</id>
<item>Item B</item>
</group>
</xml>
var vReq:URLRequest = new URLRequest("theList.xml");
var ldr:URLLoader = new URLLoader(vReq);
ldr.addEventListener(Event.COMPLETE, onXMLLoaded);
function onXMLLoaded(e:Event):void {
var xDoc:XMLDocument = new XMLDocument();
xDoc.ignoreWhite = true;
var vTrack:XML = new XML(ldr.data);
xDoc.parseXML(vTrack.toXMLString());
var vTotalTrack:Number = xDoc.firstChild.childNodes.length;
for (var i=0; i < vTotalTrack; i++) {
trace(xDoc.firstChild.childNodes*.childNodes[0]);
trace(xDoc.firstChild.childNodes*.childNodes[1]);
}
}
the output is :
<id>1</id>
<item>item A</otem>
<id>2</td>
<item>item B</item>
I have tried the
xDoc.firstChild.childNodes*.childNodes[0].value
xDoc.firstChild.childNodes*.childNodes[0].data
but it doesn’t work …
i just want the output :
1
item A
2
item B
anybody could help ??
Thanks