Tip

XQuery 1.0: A long time coming, now what?

When the XQuery 1.0 Recommendation was finally approved on January 23, 2007, it marked the culmination of a long-term series of efforts that got underway at around the same time as XSLT and XPath (though both of those recommendations achieved

    Requires Free Membership to View

2.0 status on the same date as XQuery 1.0). A popular analogy for explaining XQuery is to liken it to the Structured Query Language (SQL) widely used for accessing databases of all kinds, by saying that "XQuery is to XML documents as SQL is to compatible databases."

But the analogy goes further. In fact, XQuery shares many semantic features with SQL, so that just as SQL provides database users with the tools they need to request, extract and format data results from databases by means of structured queries, so also does XQuery do likewise for users who seek access to contents and data within XML documents.

This proclamation from the XML Query project makes this crystal clear: "The mission of the XML Query project is to provide flexible query facilities to extract data from real and virtual documents on the World Wide Web, therefore finally providing the needed interaction between the Web world and the database world. Ultimately, collections of XML files will be accessed like databases" (citation from a mailing list posting from Jonathan Robie, an editor of the XQuery 1.0 Recommendation, to Tim Bray and Michael Champion dated 10/25/2003).

In this connection, it's also worth observing that most major database engines, including IBM DB/2, Microsoft SQL Server, Oracle, MySQL and many others, already support XQuery and are thus just raring to go work against XML document sets.

Basic knowledge ingredients needed to work with XQuery include a working knowledge of basic markup languages (XML and HTML will do nicely), XML namespaces and how they operate, and XPath, which works in tandem with XQuery to target specific document collections for interrogation. In fact, those already familiar with XPath will understand XQuery best as a set of specially-formatted XPath expressions specifically aimed at locating and extracting elements and attributes from XML documents (or collections of such documents). Of course, some familiarity with SQL won't hurt either, so XQuery is as likely to draw-in database and application developers, as it is to extend the reach of XML pros.

If you want to start digging into XQuery and mastering this query language, here are several great places to get started:

  • W3Schools offers a terrific and fairly detailed XQuery Tutorial that's chock-full of examples, syntax illustrations, features and functions.
  • A set of XQuery function examples from Priscilla Walmsley, taken from her recently released (April, 2007) O'Reilly book entitled XQuery (O'Reilly Media, Apri1 1, 2007, ISBN: 0596006349).
  • A set of tutorial materials developed in 2003 by Anders Møller and Michael I. Schwartzbach for their book An Introduction to XML and Web Technologies (Addison-Wesley, January 2006, ISBN: 032169667).

For a lengthy list of related publications, tutorials and example sets see the links at the end of the W3C's XML Query page. There's more material than you can shake a stick at and plenty to help just about anybody get into this fascinating subject matter.

About the author

Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. Among his many XML projects are XML For Dummies, 4th edition, (Wylie, 2005) and the Shaum's Easy Outline of XML (McGraw-Hill, 2004). E-mail Ed at etittel@techtarget.com with comments, questions or suggested topics or tools for review.

This was first published in June 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.