Hi everyone,

I'm a newbie programmer in Flex and I need your help to fix an issue 
that I face regarding XML reading.

It seems that I've got a problem accessing an element from XML if the 
XML only has one item.

For example:

if the xml is as follows:
<?xml version="1.0" encoding="utf-8"?>
<iteration>
<iteration_no>iteration12</iteration_no>
<iteration_duedate>2007-04-17</iteration_duedate>

<burn_down_rec>
               <record_date>2007-04-01 10:28:49</record_date>
               <remaining>830.0</remaining>
               <work_done>5.10</work_done>

</burn_down_rec>
</iteration>

That xml is retrieved through an HTTPService object 
called "burnDataRequest"
Then I'd like to go through the "burn_down_rec" element in the xml 
using:

for each(var itemXML:Object in 
burnDataRequest.lastResult.iteration.burn_down_rec){
    trace("itemXML: " + itemXML.record_date);
}

The above code will only work if the returned xml has more than 1 
<burn_down_rec> elements, but it doesn't work if it has only one 
element.

I'd be great if anyone can help me sort out this problem so that my 
code will work even if the xml only has one element.

Thanks in advance for reading my post,

Ivan.



Reply via email to