Reputation: 8131
i use actionscript 2.0. I need to get time string from this simple xml:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<time>
2011,01,25,10,58,02
</time>
</root>
I used
trace(_myXml.firstChild.firstChild.nodeValue);
trace(_myXml.firstChild.firstChild[0].nodeValue);
trace(_myXml.firstChild.nodeValue);
but it returns ever undefined
...
what's wrong?
Is there a way to access xml like: _myXml.root.time.value
?
thanks.
Upvotes: 1
Views: 1784
Reputation: 2185
try this
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.load("nomeofyourxml.xml");
xmlData.onLoad = function():Void {
qtd = this.childNodes[0].childNodes.length;
trace(qtd)
for (i=0; i<qtd; i++) {
_xml = this.childNodes[0].childNodes[0].childNodes;
trace(_xml);
}
}
my trace result is: (2011,01,25,10,58,02)
Upvotes: 1