Step 1 : drag DataGrid Component into stage and delete it.

Step1. Paste below code

import fl.data.DataProvider;
import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

xmlLoader.load(new URLRequest(“sampleXML.xml”));

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseBooks(xmlData);
}

function ParseBooks(bookInput:XML):void {
trace(“XML Output”);
trace(“————————“);

var titleList:XMLList=bookInput.Book.title;
var authorList:XMLList=bookInput.Book.author;

var dp:DataProvider=new DataProvider(xmlData);

var dg:DataGrid = new DataGrid();
dg.setSize(400, 300);
dg.editable=false;

var col:DataGridColumn;
col = dg.addColumn(“Author”);
col.dataField =”author”;
col = dg.addColumn(“Title”);
col.dataField =”title”;
dg.dataProvider=dp;

addChild(dg);
}

3. Make xml file (sampleXML.xml)

<?xml ver=”1.0″ ?>
<Books>
<Book ISBN=”0553212419″>
<title id=”1″>Sherlock Holmes :Complete Novels …</title>
<author>Sir Arthur Conan Doyle</author>
<date>2010/10/12</date>
</Book>
<Book ISBN=”0743273567″>
<title id=”1″>The Great Gatsby</title>
<author>F. Scott Fitzgerald</author>
<date>2010/10/14</date>
</Book>
<Book ISBN=”0684826976″>
<title id=”1″>Undaunted Courage</title>
<author>Stephen E. Ambrose</author>
<date>2010/10/20</date>
</Book>
<Book ISBN=”0743203178″>
<title id=”3″>Nothing Like It In the World</title>
<author>Sir Arthur Conan Doyle</author>
<date>2010/10/30</date>
</Book>
</Books>

4.Run Program