For use with Sedna 3.2.64 and onwards.

The JCP released the final version of the XQuery API for Java (XQJ) specification on the 24th of June 2009. The expert group backing it's development included Oracle, Intel, Nokia, Software AG and Jason Hunter to name a few.
NOTICE: This is an early BETA version. This software is still under development!
Please report bugs here.
import javax.xml.xquery.*; import javax.xml.namespace.QName; import net.cfoster.sedna.xqj.SednaXQDataSource; public class QuickStart { public static void main(String[] args) throws XQException { XQDataSource xqs = new SednaXQDataSource(); xqs.setProperty("serverName", "localhost"); xqs.setProperty("databaseName", "test"); XQConnection conn = xqs.getConnection("SYSTEM", "MANAGER"); XQPreparedExpression xqpe = conn.prepareExpression("declare variable $x as xs:string external; $x"); xqpe.bindString(new QName("x"), "Hello World!", null); XQResultSequence rs = xqpe.executeQuery(); while(rs.next()) System.out.println(rs.getItemAsString(null)); conn.close(); } }
There is an XQJ Tutorial here on this site for use with the Sedna XQJ API.
API Javadocs for the XQJ API can be found here.
For use with Sedna 3.2.64 and onwards.