1 Reply Latest reply on May 19, 2011 2:29 AM by blazejewicz

    Convert XML String into Array Collection

    194642537 Level 1

      Hi All,


         I have an xml string













        I wanted to build a datagrid with the values from <tag>.


        Can anybody help me with this?


        Any help or suggestions is highly appreciated.



        • 1. Re: Convert XML String into Array Collection
          blazejewicz Level 4



          there could be many different ways to do that. The main point is that you can obtain reference to your XML by casting data into XML object or creating it directly, etc,

          Here is some basic example:





          import mx.collections.XMLListCollection;



                    private var xmlListCollection:XMLListCollection = null;


                    private var tagsXML:XML = <tags>











                    protected function initApp():void


                         xmlListCollection = new XMLListCollection(this.tagsXML.tag);





          <s:DataGrid x="10" y="10" width="100%" dataProvider="{xmlListCollection}"




                         <s:GridColumn dataField="fn" headerText="First Name"></s:GridColumn>

                         <s:GridColumn dataField="ln" headerText="Last Name"></s:GridColumn>








          Peter Blazejewicz