Hi Burkhard,
The thing about the warn argument is that it can be updated by the Java call. So I think you will need to pass in a suitable Java object. For this case I tried an ArrayList
import module namespace bdrc = "io.bdrc.ewtsconverter.EwtsConverter"; let $warn:=Q{java.util.ArrayList}new() let $roman := "bk ra shise bde legs" let $result:=bdrc:toUnicode($roman,$warn,true(),false()) return map{"result": $result, "warn": Q{java.util.ArrayList}toString($warn) }
Results in map { "warn": "[line 1: ""bk"": Expected vowel after ""k"".]", "result": "བཀ་ར་ཤིསེ་བདེ་ལེགས" }
I don't know if this is right or not. There are better ways to pick apart $warn.
/Andy
On Tue, 11 Apr 2023 at 13:16, Burkhard Quessel bquessel@gmail.com wrote:
*Subject:* java binding passing variables
I am trying to use xquery to transform Tibetan which is presented in Roman script to Unicode, i.e. into original Tibetan script. For this I use existing java code from here:
https://github.com/buda-base/ewts-converter/blob/master/src/main/java/io/bdr...
I add the jar of this code ( https://jar-download.com/artifact-search/ewts-converter) to my basex library and import like this:
import module namespace bdrc = "io.bdrc.ewtsconverter.EwtsConverter";
I can then use a java method to convert my Romanised Tibetan text to Unicode Original Tibetan script like so:
let $roman := "bkra shis bde legs"
return
bdrc:toUnicode($roman)
so far it works perfectly:
བཀྲ་ཤིས་བདེ་ལེགས
My problems begin when I try to add additional parameters to the conversion.
The java documentation lists a number of possible parameters:
*toUnicode(String str, List<String> warns, boolean sloppy, boolean lenient)*
(I want the “warns” one) but I am just too stupid to figure out how exactly to include this in in my xquery code. Can anyone help out?
Thanks Burkhard