I am reading an xml file in actionscript.
I need to loop through each node named "entry" as showing in below image :-
Can anyone help me ?
I am trying below code. but it not working :-
var categoryList:XMLList = x.feed.@entry;
for each(var category:XML in categoryList)
{
trace(category.@name);
for each(var item:XML in category.item)
{
trace(" "+item.@name +": "+ item);
}
}
"entry" node also has some inner nodes, I also want to read those nodes.
Thanks
This XML is using the namespace http://www.w3.org/2005/Atom
, so you have to account for that:
var n:Namespace = new Namespace("http://www.w3.org/2005/Atom");
var categoryList:XMLList = x.n::entry;
Update: In order to access child nodes, you will need to continue to use the namespace
for each(var category:XML in categoryList)
{
// this traces the name of the author
trace(category.n::author.n::name.toString());
}