One of the best improvements of AS3 is the inclusion of native support for parsing xml with e4x. E4X give us the possibility of parsing xml data as objects.
You can access the information using “dot” notation ie node_name.node_child_node_child…
As any technology there are advantatges and disadvantatges:
Advantatges:
This technology is fast to write, very intuitive and saves a lot of typing.
Disadvantatges:
You must be careful about what are you filtering, large xml means an increasing of flash player time to parse the file, which is stored in memory temporarely, and this is a quite important performance issue.
In the next example you can find how can you filter a xml file using this technique:
[SWF]wp-blogfiles/bin-release/regex.swf, 500, 576[/SWF]
And here some code:
private var _xml:XML;
private function init():void
{
loadXML("../assets/XML/texts.xml");
}
private function loadXML(xml:String):void
{
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, handler_xmlIsLoadedCorrectly);
loader.dataFormat = "e4x"
loader.load(new URLRequest(xml));
}
private function handler_xmlIsLoadedCorrectly(event:Event):void
{
_xml = new XML(event.target.data);
TA_Xml.text = _xml.toString()
}
private function handler_searchStringIsChanged(event:Event):void
{
var reg:RegExp = new RegExp(TI_SearchString.text);
TI_Results.text = _xml..item.(reg.test(text)).@id
}
I hope you find it useful!
Related posts:
- Flex swf optimization ( I )
- Flex, Amazon S3 and custom headers
- Compile CSS to SWF memory bottleneck
- Creating your first BlazeDS project

Check your RSL location. The app above can’t find them.
404 on http://blog.ncatstudios.com/framework_3.1.0.2710.swz
Error #2032: Stream Error. URL: framework_3.1.0.2710.swf