ECMAScript for XML Guide and Resources
ECMAScript for XML, which is usually referred to as E4X, was designed to make XML data easier to work with.
While E4X never enjoyed broad adoption and has been removed from all modern browsers, it is still used in some Flash other Adobe products.
What is E4X?
However, the data itself always remains a separate entity — a resource used by a script — rather than becoming part of the script itself.
In short, E4X makes working with XML data a much more flexible process and speeds up the parsing of data since it exists as a primitive data type rather than an external resource.
E4X sounds pretty great, right? If you use XML on a regular basis you might be wondering why E4X isn't supported natively by every browser. To figure out what happened to E4X, let's go to the tape.
History of E4X
E4X was originally developed at BEA Systems by Terry Lucas and John Schneider, and implemented for the first time in BEA WebLogic Platform 7.0 in 2002.
This actually predated the formal completion of the E4X specification, which was released more than two years later in 2004. Shortly thereafter, E4X was implemented by Firefox and support was also added to Adobe's ActionScript 3.
In addition, Mark S Miller, a research scientist at Google, observed that the Firefox implementation of E4X deviated "from the (official E4X) spec in ways that are not written down anywhere."
Another factor that may have contributed to the lukewarm acceptance of E4X was the concurrent development of JSON.
JSON solved many of the same problems that E4X attempted to solve with XML, but JSON solved them without requiring a bolt-on ECMAScript extension and without the consistency issues that plagued E4X.
In other words, while E4X enjoyed early adoption by Firefox and Adobe, it was never consistently implemented and lost out to rivals such as JSON. As a result, browser support never expanded beyond Firefox.
Since E4X support was added to ActionScript 3, support for E4X had to be built into every Adobe application that implements ActionScript 3. As a result, E4X does live on in Adobe products.
Browser Support for E4X
While E4X was at one time supported by Firefox, support was deprecated in Firefox version 16 in October of 2012 and subsequently removed from Firefox in version 18 in January of 2013.
Modern E4X Application
If you need to learn more about E4X, there's a good chance it's because you're going to be using it for an Adobe Flash application. E4X's most visible modern use occurs within the Adobe Flash ecosystem.
E4X is implemented in ActionScript 3 and supported by several modern Adobe products including Flash CS3, Adobe AIR, Adobe Flex, Adobe Acrobat, and Adobe Reader. However, non-Adobe implementation of E4X is virtually nonexistent.
If you already know ActionScript or JavaScipt, learning how to manipulate XLM data with E4X won't be hard. E4X is just a bolt-on component for the ECMAScript rendering engine. As a result, all you'll need to do is learn the XML-specific functions and you'll be ready to roll.
Most E4X resources are fairly dated. However, since development of E4X is not ongoing, these dated resources are still accurate and useful. We've tracked down some of the best E4X resources so that you can learn what you need to know to manipulate XML data with E4X and ActionScript.
Adobe ActionScript 3.0 Documentation | The E4X Approach to XML Processing: since modern E4X use is primarily limited to their products, Adobe are also the best place to learn about E4X.
XML.com, Introducing E4X by Kurt Cagle: a brief introduction to E4X that covers the basics.
Mozilla Developer Network | E4X Tutorial: this tutorial has been deprecated. However, the content is still solid and useful.
Mozilla Developer Network | Processing XML with E4X: this tutorial is a natural next-step after completing the previous MDN E4X tutorial.
E4X Quick Start Guide: this guide covers the E4X basics quickly.
ECMA-357, 2nd Edition, December 2005: ECMAScript for XML (E4X) Specification: the official, now-deprecated E4X specification. If you need to know E4X in-depth, the official documentation is the most in-depth resources available.
E4X was a good idea that was inconsistently implemented and beat out by competing technologies. However, it lives on in products that support ActionScript 3 and is supremely useful for creating and manipulating XML data with ECMAScript.
Further Reading and Resources
We have more guides, tutorials, and infographics related to coding and website development:
Composing Good HTML: this is a solid introduction to writing well-formed HTML and using HTML validator software.
CSS3 — Intro, Guides and Resources: this is a great place to start learning webpage layout.
ActionScript Guide and Resources: learn to code for Flash and other Adobe products.
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn?
It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"