The Sedna XQJ API

Quick Start Conformance Report Compliance Definition Statement Download Sedna XQJ API

Sedna XQJ API

Quick Start

  1. Download and install the Sedna XML Database.
  2. Create a Database called "test" and start it.
  3. Download the Sedna XQJ API (sedna-xqj-api.zip).
  4. Compile and run the following code.
import javax.xml.xquery.*;
import javax.xml.namespace.QName;
import net.xqj.sedna.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();
  }
}