Before you start
Learn what to expect from this tutorial and how to get the most out of it.
XQuery has quickly become the industry standard for querying XML documents. However, anyone who works with complex XML documents inevitably finds that detailed XQuery expressions can quickly become awkward and hard to understand. Further, some XQuery expressions are repeated within a variety of processing routines. This creates redundant expressions and adds complexity to system maintenance.
Enter XQuery functions. They provide a powerful and often overlooked means of processing XML with three distinct advantages: reusability, easier readability, and a separation of concerns.
This tutorial guides you through the process of creating XQuery functions and using them in a simulated eCommerce environment.
This tutorial covers exactly what XQuery functions are, their advantages, and how to implement them. It guides you through the implementation of an XQuery function within a simulated eCommerce environment using a Java Runtime Environment (JRE) and DataDirect's XQJ package. At the end of this tutorial, you will have a working example of an XQuery function and its applicability to a business requirement.
This tutorial is written for people who already have an understanding of XML, the Java programming language, and XQuery. For more information about learning XML, Java programming, or XQuery, see Resources.
To run the examples in this tutorial, you need to have the following installed:
- Java Standard Edition platform (Currently, the latest version is 1.6, which is the version recommended for this tutorial.)
- DataDirect XQuery (The libraries for XQJ must be in the classpath of your Java environment. They will be referenced by the Java class that you develop in this tutorial.)
For more information about these products, see Resources. You might want to download the sample code provided with this tutorial before you start. See Downloads.


