# XML date sorting

**URL:** <https://forum.kirupa.com/t/xml-date-sorting/286691>\
**Category:** flash\
**Created:** [April 19, 2009, 4:17pm UTC](https://forum.kirupa.com/t/xml-date-sorting/286691 "2009-04-19T16:17:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esseti](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Esseti](https://forum.kirupa.com/u/Esseti)\
**Post date:** [April 19, 2009, 4:17pm UTC](https://forum.kirupa.com/t/xml-date-sorting/286691/1 "2009-04-19T16:17:17Z")

</div>

XML:

```auto

<root>
<something1>
</something1>
<news>
  	<item data="18.04.2009" tytul="News1"><![CDATA[To jest <b>cialo</b> newsa1.]]></item>
	<item data="15.03.2009" tytul="News2"><![CDATA[To jest <b>cialo</b> newsa2.]]></item>
	<item data="15.04.2009" tytul="News3"><![CDATA[To jest <b>cialo</b> newsa3.]]></item>
  </news>
<something2>
</something2>
</root>

```

AS:

```auto

var xmlRequest:URLRequest = new URLRequest("data.xml");
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML;

function xmlLoaded(e:Event):void {
	xmlDone = true;
	xmlLoader.removeEventListener(Event.COMPLETE, xmlLoaded);
	xmlData = new XML(e.target.data);
};

xmlLoader.load(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

// frame 2
var xmlNews:Array = new Array();
for each(var item in xmlData.news.*) {
	xmlNews.push(item);
}
trace(xmlNews);

```

Question: How can I sort the xmlNews:Array by the @data attribute?
