E4X or ECMAScript for XML in Flash

Somewhere around the second quarter of this year, RichInternet.de mentioned about one of their message about E4X on FlexCoders. With the announcement of Flash Player 8.5, Flex Builder 2 and eventually the next Flash IDE, version 9 that will support the much anticipated ActionScript 3.0, it is about time we look back to that topic.

E4X Specification states, E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names and other mechanisms to facilitate XML processing.

What does E4X have to do with ActionScript?

We know that ActionScript’s core language is based on ECMAScript. But ECMAScript (ECMA-262) had no way of working with XML Data. ActionScript 1.0 and 2.0 had classes and methods for working with XML data, they are however were not based on ECMAScript standard.

With the new ECMAScript Edition 4, it defines a new set of classes and functionality for working with XML Data. Well, these classes and functionality are what is called E4X or more appropriately ECMAScript for XML.

Well, it will make ActionScripting easier, simpler, cool!

  • Simple – E4X makes it easier to write and understand code while working with XML Data
  • Consistent – Methods and reasoning behind E4X is consistent and consistent with other part of ActionScript
  • Same as what we have been doing – You can now manipulate XML data with well-known operators like the dot operator (.)

Leave a comment