XML News from Tuesday, August 28, 2007

The W3C Web API Working Group has published the first working draft of ElementTraversal Specification. "This specification defines the ElementTraversal interface, which allows script navigation of the elements of a DOM tree, excluding all other nodes in the DOM, such as text nodes. It also provides a property to expose the number of child elements of an element. It is intended to provide a more convenient alternative to existing DOM navigation interfaces, with a low implementation footprint." Hmm, just what the DOM needs: yet another way to do it.

ElementTraversal provides some extra properties/methods for navigating only through elements, while ignoring text and white space:

This makes it easier to process record-like XML, but inappropriate for reading documents with mixed content.

Leaving aside the issue of whether ElementTraversal is a reasonably designed API considered in isolation, I think it's time to wake up and realize that the DOM has been a massive hobble on XML for years now, and it's time to abandon it. Everything we add to it is just putting lipstick on a horse. Lately I've been realizing that outside the XML community, the uptake in JSON, YAML, and competitive formats isn't as much a reaction to XML as it is a reaction to DOM. Most developers don't distinguish between DOM and XML, especially in the JavaScript community. DOM disgusts them (which only proves they have good taste). They then proceed to throw out the XML baby with the DOM bathwater.

The whole enterprise of a cross-language API was doomed from the start. Browsers should move to E4X, and sooner rather than later. Standalone programs should move to language specific APIs like XOM and Amara. Let's deprecate DOM, recognize it for the mistake it was, and get on with our lives and our work. There are better alternatives out there. Let's use them.