Could you send that in XML?

A collegue pointed me to an interesting article extolling the virtues of microformats today. I tend not to be a fan of microformats, as they strike me as a kludgy way to achieve a subset of the functionality of XML, without nearly the expressive power. There’s something to be said for the 80/20 rule, but IMHO, microformats don’t get you there. Whatever, some people love them.

On the other hand, the discussion/arguments surrounding microformats are of interest to me, so I’m eager to read about them (plus their website is really slick).

A point this article seemed to take as a universally held opinion struck me as very odd though, and certainly wrong in my case. Here’s the passage that made my ears prick:

If I publish some information in a custom XML format for example, all consumers and intermediaries who process that information have to pay the XML complexity tax. They need to know about my custom schema, about validation, about stylesheets, about transformation and so on.”

“But what if I just want to see a piece of information or print it or search it or e-mail it or copy/paste it into my word processor? Should I have to pay the XML complexity tax for these simple requirements?”

Unless you are sending me an atomic piece of data like a number or a very small string, I’m certain I’d rather have the data marked up as XML. You need not send a schema… XML is human readable. But if you can send a schema, all the better. Even if I don’t need it now it may be of value to me in the future.

I’ve discovered that I would much rather receive any piece of non-trivial data marked up as XML rather than in it’s ‘raw’ form be it via a simple personal email or a web service. Why?

XQuery. That’s why.

Say you are sending me some movie listing info, that I just want to ‘copy/paste’ into another document. What if I want to format the data just a little bit, say add tabs or new lines or bullet points or something. Nothing extravagant, just a little formatting. Or, what if I want to format the data into executable code, say strings to be hardcoded into a JavaScript or Python program?

These types of data transformation are much much simpler and more flexible with structured data. Sure, you could try using some regexes to transform or alter the raw data, but it’s much easier to alter the data in both simple and complex ways using XQuery. XQuery totally blows away any raw text processing in power and even simplicity IMO. And on top of that, XQuery basics are very simple to learn.

There’ s just one missing piece of the puzzle: A simple, elegant, graphical tool for creating and executing your XQuery. hmmm… I wonder where you could find one.

I can’t stress enough how handy and convenient I find XQuery+AquaQuery for tackling small tasks or automating text processing. Even little one-off jobs.

I see no complexity tax for using XML for everyday data exchange. In fact, my experience is quite the opposite. Why all the XML hate?

Leave a Reply