Log in

View Full Version : xml recognizing inner tags



punstc
03-11-2009, 05:39 PM
I'm having a strange issue with xml that i cant figure out. When I try to just trace out my xml it traces everything out fine without any problems. As soon as I try to trace out my inner tags or elements it doesn't error and it doesn't trace any thing out. heres what I have.



var imageXmlLoader:URLLoader = new URLLoader();
var imageXmlRequest:URLRequest = new URLRequest("images.xml");


imageXmlLoader.load(imageXmlRequest);
imageXmlLoader.addEventListener(Event.COMPLETE, sortImageXML);

function sortImageXML(e:Event)
{
var imageXml:XML = new XML(imageXmlLoader.data);
trace(imageXml.imageList);

}


here's my xml



<?xml version="1.0" encoding="UTF-8"?>
<imageList>
<image>images/full/001.jpg</image>
<image>images/full/002.jpg</image>
<image>images/full/003.jpg</image>
<image>images/full/004.jpg</image>
<image>images/full/005.jpg</image>
<image>images/full/006.jpg</image>
<image>images/full/007.jpg</image>
<image>images/full/008.jpg</image>
</imageList>


so when I just trace like this
trace(imageXml); it works fine and outputs the xml

as soon as I try trace like this
trace(imageXml.imageList); it doesnt output anything and doesnt error anything.

i've never had any problems doing it this way before, any one have any ideas?

punstc
03-11-2009, 08:59 PM
I found the answer. Because i was trying to trace out my first xml node imageList it wasn't working. I skipped the imageList and went right to image and it worked fine.