This content has been marked as final. Show 3 replies
This is not a bug - it is working as intended. Not everyone wants a single result to be an array. You have to code for the possibility. You can always use ArrayUtil to make the result into an array. ArrayUtil will not nest one array inside of another - it only makes an array if the argument it is given is not already an array.
I have the same problem. And there is another problem when the source XML has no row.
A workaround (with catalog.xml in flexstore demo)
if (catalogConn.lastResult.catalog == null)
// no child
source = new ArrayCollection();
source = (catalogConn.lastResult.catalog.product is ArrayCollection
? catalogConn.lastResult.catalog.product as ArrayCollection
: new ArrayCollection(ArrayUtil.toArray(catalogConn.lastResult.catalog.product)));
productAC = source;
I agree with furDervish. Why would you not have a collection for a single element in the case where two elements would produce a collection? Can you please show an example of the code to deal with this problem. I'm having serious trouble detecting 1 element from none. I get null reference if there is only one child element in the xml structure.