doesn't parse xml when it's a single node

Posted by tag on Stack Overflow See other posts from Stack Overflow or by tag
Published on 2010-05-10T04:20:51Z Indexed on 2010/05/10 4:28 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

my script.php returns this XML

<all>
  <item>
     <field1>value1</field1>
     <field2>value2</field2>
  </item>

  <item>
     <field1>value1</field1>
     <field2>value2</field2>
  </item>
</all>

The HTTPService uses the default resultFormat="object" but I don't declare it since it's the default.

Then I bind it to a List

dataProvider="{getDataHTTP.lastResult.all.item}"

I get no problems when the number of item returned is more than 1. But when it's only 1 item I get an error cannot convert XMLList to mx.collections.IList.

I tried different solutions including trying to cast it as XMLListCollection but it still gives an error for single items. Does anyone know of a way to possibly solve this?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex