hello!
i’m trying to save the content of an xml file into an array. I parse the xml correctly, but i can’t seem to store the data in the array.
I just can’t seem to get it to work, although my codes seems correct to me, can you have a quick look?
function xml2array(xml:XML)
{
var num:Number = xml.firstChild.childNodes.length;
output = new Array();
for (var i = 0; i<num; i++)
{
output* = {mytitle:unescape(xml.firstChild.childNodes*.attributes.title), mydate:unescape(xml.firstChild.childNodes*.attributes.date), printurl:unescape(xml.firstChild.childNodes*.attributes.printurl), body:unescape(xml.firstChild.childNodes*.nodeValue)};
}
log(output);
}
i also tried
function xml2array(xml:XML)
{
var num:Number = xml.firstChild.childNodes.length;
output = new Array();
for (var i = 0; i<num; i++)
{
//tracing the xml works.
output* [0]= unescape(xml.firstChild.childNodes*.attributes.mytitle);
output* [1]= unescape(xml.firstChild.childNodes*.attributes.mydate);
output* [2]= unescape(xml.firstChild.childNodes*.attributes.printurl);
output* [3]= unescape(xml.firstChild.childNodes*.nodeValue)};
}
log(output);
}
via tracing, everything is fine up to the output* lines.
tracing shows for output: [object Object],[object Object]
Any idea ??