Re: [flexcoders] Retrieving an item in an xml.

2007-04-01 Thread Hilary Bridel

Hi Ivan,
Take a look here:
http://tech.groups.yahoo.com/group/flexcoders/message/67928

Hilary

--


On 01 Apr 2007 17:14:05 -0700, ivansebastiansurya <
[EMAIL PROTECTED]> wrote:


  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:


iteration12
2007-04-17


2007-04-01 10:28:49
830.0
5.10




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
 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.







--
Hilary

--


[flexcoders] Retrieving an item in an xml.

2007-04-01 Thread ivansebastiansurya
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:


iteration12
2007-04-17


   2007-04-01 10:28:49
   830.0
   5.10




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 
 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.