Am 05.04.2019 um 11:15 schrieb Andre Bovy:
Hi Chistian,
I am trying to use a very Big Integer in BaseX (9.1.2)
With this value : declare namespace BigInteger = "java:java.math.BigInteger";
BigInteger:new("12345678901234567890”)
I received : Cannot convert xs:string to xs:integer: "12345678901234567890”.
The java method that I used returns a BigInteger, but I just need the value as a String.
If you have the BigInteger returned from your Java method and want it as an XQuery string try let $s as xs:string := BigInteger:toString($valueFromJavaMethod) or let $s as xs:string := $valueFromJavaMethod => BigInteger:toString() e.g. a complete example that works for me with BaseX 9 is declare namespace BigInteger = "java:java.math.BigInteger"; let $s as xs:string := BigInteger:TEN() => BigInteger:toString() return $s Not sure about that problem with the constructor, with Saxon declare namespace BigInteger = "java:java.math.BigInteger"; let $s as xs:string := BigInteger:new("12345678901234567890") => BigInteger:toString() return $s runs fine as well but with BaseX I get the error you mentioned.