Handling XML files is pretty much fun and easy in Flex. It provides easy and fast access to data, also one can display the received data in various ways, like in a combo box, datagrid etc..

Return type of an XML can be set explicitly, but if not specified, Flex automatically converts it into an ArrayCollection of Objects. That means, if you have an XML file having a structure like this –

<entry>

<sample>

<sampleID>….</sampleID>

<sampleName>….</sampleName>

</sample>

<sample>

….

….

</sample>

</entry>

Flex will convert it into an ArrayCollection, with each sample tag as an Object in that ArrayCollection, having the properties sampleID and sampleName.

But one very peculiar feature of Flex is that, if you have only one entry in the XML file, that is, if there is only one sample tag, then instead of converting the XML into an ArrayCollection, it will convert it into a single Object. So you need to receive the data in an object instead of an ArrayCollection else it will give an Object Proxy error.