Created
December 4, 2013 18:38
-
-
Save cfoster/7793034 to your computer and use it in GitHub Desktop.
Using BaseX Local/Embedded via XQJ 1.3.0-SNAPSHOT.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>net.xqj</groupId> | |
<artifactId>basex-xqj-example</artifactId> | |
<version>0.0.1</version> | |
<packaging>jar</packaging> | |
<dependencies> | |
<dependency> | |
<groupId>net.xqj</groupId> | |
<artifactId>basex-xqj</artifactId> | |
<version>1.3.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.basex</groupId> | |
<artifactId>basex</artifactId> | |
<version>7.8-SNAPSHOT</version> | |
</dependency> | |
</dependencies> | |
<repositories> | |
<repository> | |
<id>basex</id> | |
<name>BaseX Maven Repository</name> | |
<url>http://files.basex.org/maven</url> | |
</repository> | |
<repository> | |
<id>xqj.net</id> | |
<name>XQJ.NET Maven Repository</name> | |
<url>http://xqj.net/maven</url> | |
</repository> | |
</repositories> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.xqj.basex.local.BaseXXQDataSource; | |
import javax.xml.xquery.*; | |
public class XQueryExample | |
{ | |
public static void main(String[] args) throws XQException | |
{ | |
XQDataSource xqds = new BaseXXQDataSource(); | |
XQConnection conn = xqds.getConnection(); | |
XQPreparedExpression xqpe = | |
conn.prepareExpression("1,2,3,4"); | |
XQResultSequence rs = xqpe.executeQuery(); | |
while(rs.next()) | |
System.out.println(rs.getItemAsString(null)); | |
conn.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment