Hi all, Thanks for your answers. Actually I have to use Java binding to call some methods, the code which I provided is just an example. I wanted to call this method:
publicProcessingResult https://get.carrot2.org/stable/javadoc/org/carrot2/core/ProcessingResult.html process(List http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true<Document https://get.carrot2.org/stable/javadoc/org/carrot2/core/Document.html> documents, String http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true queryHint, Class http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true<?>... processingComponentClasses) throwsProcessingException https://get.carrot2.org/stable/javadoc/org/carrot2/core/ProcessingException.html
(https://get.carrot2.org/stable/javadoc/org/carrot2/core/Controller.html#proc...)
On 4/23/2019 13:51, Christian Grün wrote:
And a complementary remark: You can also use the built-in function out:format (it will be optimized better than Java functions):
let $string := 'Format string: %1$d - %2$s' let $i := 1 let $j := 'text' return out:format($string, $i, $j)
For formatting numbers, XQuery provides the function fn:format-number:
format-number(1, '0000')
Best, Christian
On Tue, Apr 23, 2019 at 6:41 AM Johannes Bauer johannes.bauer@tanner.de wrote:
Hi Luan,
try this:
declare namespace java = "java:java.lang.String";
let $string := 'Format string: %1$d - %2$s' let $i := 1 let $j := 'text' let $args := ($i, $j)
return java:format($string, $args)
Best regards Johannes
Am 23.04.2019 um 06:29 schrieb Luan Bui:
Hello all, How can I call a method with variable arguments in BaseX with Java binding? I am trying to do this:
let $string := 'Format string: %1$d - %2$s' let $i := 1 let $j := 'text' return Q{java.lang.String}format·java.lang.String·java.lang.Object*($string, $string, $i, $j)
However, I got the error: [XPDY0002] {java.lang.String}format·java.lang.Stri...: Context is undeclared. Thank you for your time.