XQuery from Java
Thursday, 3 January 2019 · 2 messages
T
thufir3 Jan 2019 03:50 #
I'm a tad more proficient with BaseX, but, how do I actually build an XQuery? Yes, I can write an XQuery and save it in a text file, then use BaseX for execution.
But it would be far more flexible to write the actual XQuery from within Java itself. But how?
Oracle gives an example:
OXQDataSource ds = new OXQDataSource();
XQConnection con = ds.getConnection();
String query = "<hello-world>{1 + 1}</hello-world>";
XQPreparedExpression expr = con.prepareExpression(query);
XQSequence result = expr.executeQuery();using their datasource. Cannot BaseX do something similar?
see also:
https://stackoverflow.com/q/53996575/262852
thanks,
Thufir
CG
Christian Grün3 Jan 2019 15:04 #
Quoted text · thufir · 1 line
> Oracle gives an example:
This example is based on the XQJ API. Have a look at [1] to see how it is used in BaseX (and what other APIs exist).
[1] http://docs.basex.org/wiki/Java_Examples
Quoted text · thufir · 18 lines
> > OXQDataSource ds = new OXQDataSource(); > XQConnection con = ds.getConnection(); > String query = "<hello-world>{1 + 1}</hello-world>"; > XQPreparedExpression expr = con.prepareExpression(query); > XQSequence result = expr.executeQuery(); > > using their datasource. Cannot BaseX do something similar? > > > see also: > > https://stackoverflow.com/q/53996575/262852 > > > thanks, > > Thufir
Written for BaseX 9.1. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery