Showing posts from July, 2011

Convert XML to ArrayCollection

If you have an XML and want to use it in the spark's list component, than you need to first convert it into ArrayCollection and that's what we are doing in this example:

Lets assume you have following XML:

varstrXML:XML = <blog>
              <title>Blog by Subodh Gupta
<author>Subodh Guptaauthor>

var xml:XML = new XML(strXML);
var xmlDoc:XMLDocument = new XMLDocument(xml);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var resultObj:Object = decoder.decodeXML(xmlDoc);
var ac:ArrayCollection ;

if("item")) {
      if( is ArrayCollection)
      ac = resultObj.root.element;

that's it you are done. Cheers.