The BaseX XQJ


Quick Start Conformance Report Compliance Definition Statement BaseX XQJ Examples (on GitHub) Download BaseX XQJ

BaseX XQJ API 1.4

  • Passes the XQJ Test Compatibility Kit.
  • High performance, standards based driver.
  • Provides an XQJ interface to talk to BaseX over a light-weight binary protocol.
  • Provides an XQJ interface to talk to BaseX in a local / embedded mode.
  • Distributed under the Apache 2 License.

Quick Start

  1. Download and install BaseX.
  2. Launch BaseX via the "basexserver" service.
  3. Download the BaseX XQJ API.
  4. Compile and run the following code.
import javax.xml.xquery.*;
import javax.xml.namespace.QName;
import net.xqj.basex.BaseXXQDataSource;
public class QuickStart
{
 public static void main(String[] args) throws XQException
 {
 XQDataSource xqs = new BaseXXQDataSource();
 xqs.setProperty("serverName", "localhost");
 xqs.setProperty("port", "1984");
 // Change USERNAME and PASSWORD values
 XQConnection conn = xqs.getConnection("USERNAME", "PASSWORD");
 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();
 }
}

AltStyle によって変換されたページ (->オリジナル) /