John Lam 1997 — 2026

I'm souring on XML

To be specific: I’m souring on XML as an artifact that humans generate. In the past, I’ve advocated using XML as the human-generated input to code generation tools. The more time I spend thinking about this, the more I realize that this is a bug and not a feature.

Maintaining XML is hard because the syntax gets in the way of reading the code. Reading code without superflous syntax is hard enough. The XML markup doesn’t help improve matters. This is one of the key weaknesses of XSLT - the fact that it is hard to write and harder to maintain.

Recently, I’ve been spending some time with Perl. I’ve written an HTML generation tool that creates HTML from a short-hand notation similar to this. This short-hand is powerful because it is idiomatic. It is not intuitive, but that’s not the point- I want to create content for my blog as quickly as possible and I don’t want the markup to get in the way of proof-reading my content.

I suspect that folks writing XAML will face similar problems. In the absence of IDE support, it will be rather tedious to write and maintain non-trivial XAML scripts. I suspect that this won’t be a problem once XAML tools start shipping, but I would prefer to generate XAML from a simpler, more idiomatic syntax.

This is why I’m spending time learning Perl today. For more insights in Perl as a code generation language, see this excellent interview with Sriram Srinivasan, author of Advanced Perl.

5 archived reader comments

Jack Herrington (2004-03-02)

Have you tried YAML?

Craig Andera (2004-03-02)

Hmm, a shorthand way to quickly create HTML pages…

Can you say, “wiki” ? I knew you could. :)

Stuart Dootson (2004-03-02)

You’re not alone - see http://www-106.ibm.com/developerworks/library/x-sbxml.html

Randal L. Schwartz (2004-03-09)

I’ve long pounded the desk saying that the purpose of XML is best for machine-to-machine vendor-neutral hierarchical non-binary data representation, and the further you stray from any one of those points, you lose.

I will not ever use DocBook, at least not as an input method. I do not want to edit configuration files in XML. XML is just far too verbose for me to write, and barely not-quite-enough verbose for me to tolerate reading.

nobody important (2004-03-15)

This comment may be a bit late, but I suggest you peek at pxsl. (http://community.moertel.com/pxsl)

It rocks.