XML to Datagrid in Flex

The XMLListCollection class provides collection functionality to an XMLList object and makes available some of the methods of the native XMLList class.


<?xml version=”1.0″ ?>
<Feature>Search Engine / Mail / Social Media</Feature>
<Feature>Search Engine / Mail</Feature>


<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”onCreate(event)”>
import mx.collections.XMLListCollection;
import mx.controls.Alert;
import mx.collections.ArrayCollection;
private function openXMLValues(e:Event):void
var XMLConv:XMLList=new XMLList(e.target.data)
var XMLL:XMLListCollection=new XMLListCollection(XMLConv.item) // now it points to the “item” node. XMLListCollection can hold only the XMLList
private function onCreate(e:Event):void
var XMLLoader:URLLoader=new URLLoader(new URLRequest(“c:\\CompanyDetails.xml”))
XMLLoader.addEventListener(Event.COMPLETE,openXMLValues) }
<mx:DataGrid x=”21″ y=”25″ width=”388″ height=”220″ id=”DG”>
<mx:DataGridColumn dataField=”Company” />
<mx:DataGridColumn dataField=”Feature” />


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.