Updated 2016-05-13 02:51:43 by ray2501

XQuery is an XML query language. It is tightly connected to XPath 2.0 and XSLT 2.0.

At the moment no Tcl implementation exists, partially because XQuery uses XML Schema Validation extensivly. It would probably be quite easy to provide a Tcl interface to a XQuery engine like Saxon or Galax.

Discussion  edit

NEM: Can anyone explain to me the advantage of XQuery? I use XML, XSLT and XPath a reasonable amount, and I find them useful technologies. But, of the small amount of XQuery examples I've seen, it seems to be for tasks which I can do just as easily with Tcl and tDOM. Is there a compelling reason for me to switch to XQuery? Is there some killer feature that I should be aware of?

schlenk: You're absolutely right. Most tasks you can do with XQuery can be done with Tcl and tDOM. There isn't really a killer feature yet, but consider a large (XML)-database (larger than anything you have in RAM). If Oracle, IBM and Microsoft et al. get to it, one can query their large RDBMSs via XQuery. If those large database vendors get it done right (they don't seem to do perfect, but maybe usable), one gets a better and more powerful query language than SQL that could be used for Stored Procedures and could directly produce reports etc. For other applications XQuery isn't much better than XSLT/XPath.

One thing i find nice is the fact that there is a good, human usable non-xml notation of the language, so one can use basically the features of XSLT without the overhead of writing xslt. If you know Tcl, then XQuery looks very familiar.

SRB: My understanding is that XQuery will allow an application to query multiple XML documents, whereas XPath queries only a single document. This is why XQuery is aimed at the XML database industry, rather than transformations of single documents (ie. XSLT). However, there are significant overlaps; witness the changes to XPath.

[ray2501]: add link Open Source XQuery Implementations

XQuilla and Zorba have XQC API, so I pick up XQilla and implement a Tcl extension (prototype) tclxqilla to check XQC API.