A universal canvas requires a universal way to represent data. Other solutions are conceivable, but let's accept for now that XML is a reasonable one, and that it's here to stay. How does XML become Play-doh? The first answer, for me, was Perl with its XML::Parser module. Then came XSLT (XSL Transformation), which traded away procedural idioms to gain declarative transformational power. Then came Python with its libxml/libxslt modules, which married the procedural and declarative styles in a highly interactive way. That's been my weapon of choice lately, but now there's a new contender: E4X (ECMAScript for XML).
With E4X, XML becomes a native programming-language data type. The language is ECMAScript, popularly known as JavaScript (in browsers) and ActionScript (in Macromedia's Flash player). I first heard about E4X from Adam Bosworth, who used it to manage the intelligent browser cache that was part of his Alchemy project. (Now that Bosworth has moved from BEA to Google, by the way, the future of that nascent open source project is uncertain.)
Meanwhile, the first generally available implementation of E4X has been built into the latest version of Rhino, the Mozilla project's Java-based JavaScript engine. It was demonstrated to me recently by John Schneider, the chief technologist at AgileDelta and lead editor of the E4X specification. I was immediately inspired to try it out, and you can see some sample experiments on my Weblog. I'll spare you the geeky details, but here's the gist: More than any other technology, E4X makes XML data feel like Play-doh in the hands of a programmer. That's not the endgame -- I won't be satisfied until users can reach into their XML data and make new things with it -- but it's a step in the right direction. [Full story at InfoWorld.com]
In an earlier item, I mentioned Ruby and PHP variations on this theme. Here are some others:
Michael Walter [via Ted Leung, Lambda the Ultimate, Chris Double] demonstrates XML literals in Lisp.
Frederik Lundh [via Rand Anderson] suggests XML literals in Python.
Update: Sean Gilligan referred me (via email), to Groovy's approach.
So there's plenty of interest in the idea. As I mentioned the other day, I hope it gets expressed in ways that anticipate a common approach to serializing XML objects, and connecting to XML-aware databases.
Former URL: http://weblog.infoworld.com/udell/2004/10/13.html#a1094