I tried adding a member function to see if that worked, but it didn't. I've now recoded my Java function in XQuery, but I would still like to get to the bottom of why it's not working as I'm sure I'm going to want to use this feature again soon.
Cheers Gary
________________________________ From: Christian Grün christian.gruen@gmail.com To: The Trainspotter wys01@btinternet.com Cc: "basex-talk@mailman.uni-konstanz.de" basex-talk@mailman.uni-konstanz.de Sent: Wednesday, 31 October 2012, 18:55 Subject: Re: [basex-talk] Calling static Java function from XQuery
Does your code work if you remove the "static" flag from the getEntryXPath function? ___________________________
Christian Grün Box 188, Uni KN D-78457 Konstanz http://christian-gruen.de
On Wed, Oct 31, 2012 at 7:52 PM, The Trainspotter wys01@btinternet.com wrote:
Sure, here's the module I'm trying to load:
module namespace ts="www.tspotter.net"; declare namespace xqc="net.tspotter.sdk.plugin.model.XQueryCalculator";
declare function ts:getEntryFromPrimaryKey( $primaryKey as xs:string ) { let $expression := xqc:getEntryXPath( $primaryKey ) return xquery:eval( $expression ) };
And then in my java class I have:
public class XQueryCalculator { public static String getEntryXPath( String id ) { // do some stuff return ret; } . . . }
Is there anything else you need to see?
Cheers Gary
From: Christian Grün christian.gruen@gmail.com To: The Trainspotter wys01@btinternet.com Cc: "basex-talk@mailman.uni-konstanz.de" basex-talk@mailman.uni-konstanz.de Sent: Wednesday, 31 October 2012, 18:41 Subject: Re: [basex-talk] Calling static Java function from XQuery
Hi Gary,
we are frequently using and embedding Java code in our projects. Do you have a quick example?
Christian ___________________________
On Wed, Oct 31, 2012 at 7:39 PM, The Trainspotter wys01@btinternet.com wrote:
Hi,
I followed the docs and examples on calling Java functions from XQuery, but when I try and add a package to the repository that calls one of my own functions BaseX complains that it can't find the function. I am running BaseX locally and the class I want to call is in my project's classpath. Any ideas as to what I'm doing wrong?
Cheers Gary
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk