The XQuery API for Java specification (JSR 225) is now in Early Draft Review, which is part of the Java Community Process (JCP) for developing and publishing new specifications. See http://jcp.org/en/introduction/timeline for the steps and timeline in this process. Early Draft Review makes the XQuery API for Java (XQJ) available to the public to review and submit comments to the Expert Panel. (DataDirect Technologies is a member of the Expert Panel for XQJ.) The review for XQJ is available through July 9, 2004. You can download it from: http://jcp.org/aboutJava/communityprocess/edr/jsr225/index.html.
XQuery is a new query language for XML that is being developed by the W3C XML Query Language Work Group (of which DataDirect is a member). Just as SQL is a query language that queries relational tables to create new relational tables, XQuery queries XML documents and relational sources to create XML documents. Just as SQL queries can return many different representations of the same data, XQuery queries can return many different XML documents from the same data. XQuery allows you to work in one common model no matter what type of data you're working with – relational, XML or object data. XQuery is ideal for queries that must represent results as XML, to query XML stored inside or outside the database, or to span relational and XML sources.
XQJ enables a Java application to submit XQuery queries to an XML data source and process the results. XQJ is analogous to JDBC, which in conventional SQL environments, a Java application uses to connect to a database, issue SQL queries, and obtain result sets. So, XQJ is to XQuery what JDBC is to SQL.
The difference is that XQuery uses a completely different data model; it has no concept of tables, rows, or the datatypes used in SQL. XQJ is designed to support XML queries for both XML sources and XML views of relational databases. The result of an XQuery is always XML. Here's an architectural diagram that shows how XQJ and XQuery are used for querying relational and XML sources together.

The following example, modified from the XQJ Early Draft Review, shows that the current pre-release version of XQJ is similar to JDBC.
Example - A query using XQuery and XQJ
XQConnection conn = XQDS.getConnection();
XQExpression expr = conn.createExpression();
String es = "for $n in fn:doc('catalog.xml')//item
return fn:data($n/name)";
XQResultSequence result = expr.executeQuery(es);
while (result.next())
{
String str = result.getString();
System.out.println("Product name: " + str);
}
result.close();
expr.close();
conn.close();
An application that uses XQJ would use an XQuery implementation to connect, process and execute the XML query. DataDirect Technologies is developing an implementation of XQuery called DataDirect XQuery, which implements the XQJ API.