If you want to avoid static methods you can do it as follows:
class: package org.basex; public class Test { public Test() { } public int calc(final int t) { return t * t; } }
query: declare namespace test = "java:org.basex.Test"; for $i in 1 to 10 let $t := test:new() return test:calc($t, xs:int($i))
note you have to pass a created test-object to the calc-method then...
Andreas
Am 19.12.10 18:31, schrieb Andreas Weiler:
Hi Stefan,
for example you can create a class like the following (i did create it in the org.basex package):
package org.basex;
public class Test { public Test() { } public static int calc(final int t) { return t * t; } } and run a query like the following:
declare namespace test = "java:org.basex.Test"; for $i in 1 to 10 return test:calc(xs:int($i))
so the results are: 1 4 9 16 25 36 49 64 81 100
I hope this helps, kind regards, Andreas
Am 19.12.10 18:07, schrieb stefan coremans:
The java binding explained under
http://www.inf.uni-konstanz.de/dbis/basex/xqjb
is working but i can't get it to work with a simple test class. where can i find some sample code ? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk