Whither E4X ?

E4X is an extension of ECMAScript that makes XML processing a snap in JavaScript. Read about all the details at W3CSchools or Yahoo or WikiPedia and see what IBM developers , Adobe and  others have to say about E4x and its effectiveness.  Despite the near universal acclaim, currently E4X is only supported in the Firefox browser and Adobe Flash’s ActionScript [hence the many cool XML based routines in Flex and Flash]. Unfortunately, Google Chrome, Apple Safari, Opera and IE browsers [there is an old IE E4X extension] – these vendors, 5 years after the E4X standard was announced by ECMA have still not implemented it.

It is particularly hard to see why Google and Apple which both tout their browsers JavaScript speed and use both JavaScript and XML in many key browser-based tools and features would take a raincheck on something that makes XML processing so much less tedious in web development. This turn of affairs is so quixotic, a more thorough investigation of E4X’s payoffs and obstacles/objections seemed inevitable.

Where E4X Pays Off

Configuration Files – What immediately comes to mind is parsing and supporting any XML  configuration file. This will become more important asApps and plugin technology extends from mobile and CMS to a broad range of extensible services. See here for how XML configuration information and its manipulation is simplified with E4X.
Web Services
-IBM has a very good illustration of using E4X on Web Services  requests as client interface.
RSS, ATOM, and other feed services
– Almost all of the popular feed services use XML for their storage format and here is a tutorial on how E4X simplifies such processing.
Database Access – E4X has become popular in server-side applications that take advantage of the Rhino JavaScript Engine that supports E4X. Here is an example of how Aptana’s Jaxer does server side templates using E4X to expedite the access. And here is an example of CouchDB, one of the new document-oriented databases, that uses SpiderMonkey and E4X for access to its database. Openmocha’s e4xd sub-project is a server side database template environ that uses E4X as a tool.

After an initial burst of interest, like Java, E4X development has migrated over to the server side where users can find several JavaScript engines which support E4X . The database projects above are examples. But there still is a sustaining interest in E4X in JavaScript client  based on Flash/Flex and server-server side usage of E4X.

Whats Holding-up E4X?

Doing research on another topic, JSON, I encountered some of the objections to E4X.  The key issues were lack of uniform support for E4X across the popular browsers and performance. However, an extensive search through the Web could not show any clear cut benchmarks showing JSON outperforming E4X. Rather, E4X being used in Flex was benchmarked as being faster than AJAX based JSON by about 25-40% [it depends on the browser used, see Census test here].  So performance does not appear to be a substantive issue.

Further research turned up a Security concern about markup script insertion based on Cross-site scripting vulnerabilities. Also there was a some more script injection methods discussed here. But the commenter seemed to find that a)there were simple controls to prevent these insertions and/or b)the larger issue was addressing cross-site gaps found in many technologies, not just E4X.

In general, the biggest obstacle to E4X appeared to be lack of support for it in the browsers when the the simple JSON conventions provided an immediate solution to data mapping. But there was concern noted that JSON thru data mapping finesse was throwing out a lot of XML features such as XPath, XSLT,  XSS and fast plus easy XML parsing enabled in good part by E4X.

Summary

Given above evidence and the great ease of development associated with using E4X, one has to wonder why support is lacking from major browser vendors. The delay in implementing E4x  is truly anomalous since E4X appears to be a natural in a SOA, RSS, SOAP and Web Services world upcoming in  Cloud Computing. And E4X appears to be reaching a Tipping Point. As all the major browser vendors rush to upgrade their JavaScript engines – the question is will E4X make the cut? If not, some great code hits the cutting room floor.

Why do the big browser vendors – gunning for better JavaScript features and performance in their engines ignore E4X?? Google, Apple, Microsoft and Opera are all remiss while Adobe in Flash ActionScript and Mozilla in Firefox have adopted E4x and shown it to be better than JSON in performance and XML programming features. And security is less of a concern with proper filters as shown by Adobe and Firefox. This is a most puzzling turn of Web development events.

It also makes this observer very concerned about not just E4X but broader W3C and other Web standards. Perhaps Microsoft’s 10 years of abusive behavior towards Web standards has made the attitude towards standards  a “laissez affaire”. This does not bode well for HTM5, CSS3, and other W3C standards. I have seen so many comments on the arrival date for full HTML5 amounting to skeptical “whatevers”. The general attitude seems to be that Web standards are there to be selectively fulfilled/broken as each vendor sees fit.  Is E4X support the harbinger/mine canary of what is to happen with HTML5 and Web standards in general?

5 thoughts on “Whither E4X ?”

  1. Nice post. I’m looking around for new ideas for my free web arcade game sites and I found this blog. I believe that with HTM5, there will be an upheaval of the current market even if actionscript will maintain its current share IMHO, as well as traditional games on optical media (PC Games etc..)

  2. I too have long been puzzled by the lack of industry uptake. I’ve been playing with e4x to prototype some pretty cool and powerful server-side tools and extensions (using Rhino) for a JEE app server based application that uses XML extensively (both for configuration and runtime).
    In my experience the productivity boost is significant, especially for programatically manipulating XML. The performance (not benchmarked) appears to be a lot better than XSLT and XQuery, which are being abused in terms of how they are employed in the application I mentioned earlier. I fully agree with the comment about e4x being a natural fit for SOA. However, the lack of industry support has made it a hard sell within my organisation. Yes the standard exist and is available. Yes, the w3shcools has an entry (very basic) tutorial for e4x. However there are no books on the subject to assist beginners and this makes it difficult to convince people to look at it more seriously.

    1. Dylan-The two parties that are not using and supporting E4X and who really should be are Google and Apple. Both use XML extensively in their Android +Google Web APIs and iOS4 + MacOS/x 10.x apps. Both make plenty of money. Both have every incentive to stay a few steps ahead of Microsoft who are coming on like gangbusters with all sorts of Jekyll … no its Web-nice-guy Hyde like promises with IE9. E4X implementation would seem to be a natural for the Chrome and Safari browsers … and both have seen many entreaties on their blogs to do so. Nada so far!

      So I suspect their is some other impediment. And one is the fact that Doug Crockford, Yahoo! architect, has been ambiguous about E4x. For example, he finds finds JSON much more acceptable than XML for data iontegration/messaging. Also his JSlint program for testing JavaScript code does not support E4x. With a few more inlfluentials like Doug Crockford ambiguous or nay-saying E4x and it will have a tough row to acceptance.

      Now as for E4X docs, Paul Sweatte has a superb set of tips here and IBM shows some of the neat serverside SOA stuff possible with E4X here. I think just like Java, E4X may survive on the server side and then like Android has brought Linux to new found popular acceptance on the client isde – the underlying quality that is E4X will cause it to gain a footing on the client as well.

      Again I am amazed Google’s Ian Hickson as one of key advisors on whatwg.org [editor] and HTML5 has not seen the E4X advantage.

  3. I am E4X fan and I wish I will soon get it in any scripting language (I think about Ruby and Python).
    I plan to implement it for Python…
    (while I am fighting against CSV and stupid-config-file like format, Pye4x would be a break throught easy data manipulation!).

    Thanks for the post.

  4. Politics is the reason. Must be. Why else block a technology like this? It’s so usable.

    Maybe they’re trying to favor JSON or just damage XML or playing strategic games or whatevers.

    Why Google isn’t using it in V8.. I really have no clue, it smells funny.

Comments are closed.