ECMAScript for XML (E4X), a hammer for the DOM’s shortcomings
I think the DOM specification is valuable, but in practice I’ve run into its limitations, or the limitations of its implementations, many times. The DOM is designed to be general enough to handle any document structure.
I probably run into the DOM’s shortcomings most often when working with part of an HTML document. Without unique IDs on elements, iterating over node collections is a nightmare. Add the fact that Mozilla and Internet Explorer handle whitespace differently and you can spend more time testing for portability than getting anything done.
I’ve often wished we had XPath or something like it. So I was pleased to come across Petr Cimprich’s Akta X 0407, which covers an extension to the ECMAScript specification for working with XML. The aim is to make things easier where the DOM and XSLT fall short.
The extension is designed mainly with today’s JavaScript writers, the programmers, in mind. Its creators clearly wanted to spare us another technology to learn. They opted to build it into the language, which should make it easier to pick up. E4X looks very interesting indeed. If it can make its way into the otherwise unyielding Internet Explorer, we can look forward to getting more done.
Related articles
Related CZ Podcast episodes
- #217 · Ivo Lukačovič
On Windy, JavaScript and building companies. · Czech audio
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio