Book: "Querying XML"

Welcome to the supporting page for "Querying XML: XQuery, XPath, and SQL/XML in Context" by Jim Melton and Stephen Buxton. Here you can find sample data, example queries, XQuery code, and other supporting materials for the book.
About the book
"Querying XML: XQuery, XPath, and SQL/XML in Context" by Jim Melton and Stephen Buxton is published by Morgan Kaufmann/Elsevier. Details are available from amazon.com or from the Elsevier web site.
What people are saying
Here's what people are saying about "Querying XML: XQuery, XPath, and SQL/XML in Context":
Press Release - "Mark Logic Executive Provides Expert Advice on Querying XML in Best-Selling New Book; Readers Will Learn Best Practices in Approaching Technology Standards XML and XQuery".
Amazon.com - Reviewer Frank Cohen gives it 5 stars, and says "Excellent Book On XML and XQuery".
About the authors

Jim Melton is editor of all parts of ISO/IEC 9075 (SQL) and has been active in SQL standardization for two decades. More recently, he has been active in the W3C's XML Query Working Group that defined XQuery, is co-Chair of that WG, and co-edited two of the XQuery specifications. Jim is shown holding a cous-cous (pronounced "coo coo"), though his favorite creatures are shelties (see Sheltie Rescue of Utah).

Stephen Buxton is Director of Product Management at Mark Logic Corporation. He is a member of the W3C XQuery Working Group and a founder/member of the XQuery Full-Text Task Force. Stephen has written a number of papers and articles on XQuery and SQL/XML, and is an editor of several XQuery Full-Text specs. Before joining Mark Logic, Stephen was Director of Product Management for Text and XML at Oracle Corporation.
Samples from the book
About the samples
Throughout the book "Querying XML: XQuery, XPath, and SQL/XML in Context" there are examples - XQuery expressions, XPaths, SQL/XML queries, and so on - based on data about a collection of movies. The examples in the chapters of the book are not entirely consistent, since they were produced to illustrate specific points made in the text, and they are not always complete, due to space considerations.
In Appendix A of the book, we created a more complete, consistent set of example data, metadata, and queries. Many of the examples have been copied directly from the body of the book, some have been changed only slightly, and some are completely new in the appendix.
You can download all the sample data and code in Appendix A from the download section of this page. These samples should be useful stand-alone, but of course they are designed to be read and used in conjunction with the book.
Some of the examples (both XQuery and SQL/XML) use vendor-specific syntax and/or extensions. The downside is that the examples do not exactly match similar examples in the body of the book, and they do not all conform to the latest standard syntax. The upside is that they all actually run and yield results against a stated software configuration (see Running the examples below).
What's in the samples download
The samples include:
Movies XML data - complete content for ten movies.
Metadata for the movies data - a possible XML Schema and a DTD.
XML data, XML Schema, and DTD for movie reviews.
SQL/XML queries to convert the XML data into relational data and to convert the relational data back to XML.
All the example queries from Appendix A of the book - both XQueries and SQL/XML queries.
Movie search - a complete web application written in XQuery.
Note: This application was written in a few days using MarkLogic Server, the week following MarkLogic training. The good news is it shows how quickly one can get up to speed with XQuery and MarkLogic Server and build something useful. The bad news is it's a pretty naïve implementation.
We expect to post at least two additional versions of this simple application - one that's less naïve, and one that uses AJAX. Watch this space!
Running the examples
The XQuery examples and the movie search web application were tested against MarkLogic Server version 3.0-3. To download a fully functional trial copy of MarkLogic Server, visit http://marklogic.com or click on the "Download MarkLogic Server" link at the top of this page.
The README in the downloadable samples contains detailed instructions on how to run the movie search web application on your Mark Logic installation.
You may, of course, try to run any of the XQuery examples on any engine that supports XQuery, but then you're on your own - in particular, the MarkLogic Server's full-text search extensions will be unavailable to you.
The SQL/XML examples were tested against an Oracle database, version 10.2.0.1. We used "Altova XMLSpy 2006 Enterprise Edition" and "Stylus Studio 6, XML Enterprise Edition, Release 3" to produce the XML data, metadata, and some queries. Oracle, Altova, and Stylus Studio all offer fully functional trial copies on their respective web sites.
Download the samples
Here you can read the samples README file, download the zipped samples, or go to the samples directory.
Feedback
If you have comments or questions about the samples or about the book, please send mail to Stephen Buxton.