text displaying only 1's item also array length trace shows count as 1
xml code
Code:
<content>
<item>
<name>apple </name>
<type>- fruit </type>
<color>- red </color>
</item>
<item>
<name>grapes</name>
<type>- fruit </type>
<color>- green </color>
</item>
<item>
<name>raddish</name>
<type>- veggie </type>
<color>- white </color>
</item>
</content>
as2
Code:
var shoplistXML:XML = new XML();
shoplistXML.ignoreWhite=true;
var output:String ="";
shoplistXML.load("shoplist.xml"):
shoplistXML.onLoad= function(success)
{
if (success)
{
var shoplist_content:Array = shoplistXML.firstChild.childNodes;
trace(shoplist_content.length);
for (i=0;i<shoplist_content.length;i++)
{
output += shoplist_content[1].childNodes[0].firstChild.nodeValue;
output += "<b>";
output += shoplist_content[1].childNodes[1].firstChild.nodeValue;
output += "<\b>";
output += shoplist_content[1].childNodes[2].firstChild.nodeValue;
output += "\n";
output += shoplist_content[1].childNodes[3].firstChild.nodeValue;
output += "\n\n";
}
list_txt.htmlText = output;
}
}