Notes from an XQuery practitioner

A Hungarian developer, Fejes Balazs, alerted me to a couple of his articles on XQuery -- the first a general introduction, and the second a walkthrough of XQuery transformation in BEA's WebLogic Workshop. Both are nicely done.

Given that so much more can be done with XPath and XSLT than is widely appreciated, I've been focused mainly on broadening awareness of what's possible. But I've been studying XQuery in parallel, and it recently struck me that one of the reasons XQuery is going to be important matches one of the reasons that dynamic programming languages are important: both let you play with data.

That phrase -- "play with data" -- comes to me by way of Jonathan Robie, who I met at XML 2003. Jonathan, co-author of XQuery from the Experts and co-editor of the XPath and XQuery specs, believes (as do I) that data is a substance, like clay, that you have to pound on, roll out, squeeze, mold, and generally get your hands dirty with, in order to discover its possibilities.

Over the years I've come to see that the ability to treat data like clay is a primary benefit of languages such as Perl and Python. If you had to finalize your data structures up front you'd never get anywhere, because they're emergent.

Now listen to Jonathan Robie on the subject of types in XQuery:

The type system of XQuery is one of the most eclectic, unusual, and useful aspects of the language. XML documents contain a wide range of type information, from very loosely typed information without even a DTD, to rigidly structured data corresponding to relational data or objects. A language designed for processing XML must be able to deal with this fact gracefully; it must avoid imposing assumptions on what is allowed that conflict with what is actually found in the data, allow data to be managed without forcing the programmer to cast values frequently, and allow the programmer to focus on the documents being processed and the task to be performed rather than the quirks of the type system. [XQuery From the Experts, Chapter 1: A Guided Tour]
I really like the sound of that.


Former URL: http://weblog.infoworld.com/udell/2004/02/06.html#a910