Creating Tim, ADate, Dtn, Map programatically
Friday, 30 October 2015 · 2 messages
CG
Hi James,
You can have a look at our internal instantiations of atomic types [1,2]. Items of type xs:time can e.g. be created via:
// the input string
String string = "12:34:56";
// comparable to string.getBytes(), but always UTF8 and faster:
byte[] token = Token.token(string);
// no input info available (will automatically be assigned if
// executed Java code should raise an error)
new Tim(token, null);Hope this helps,
Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/value/type/AtomType.java#L555 [2] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/value/item/Tim.java#L31
Quoted text · James Wright · 10 lines
On Fri, Oct 30, 2015 at 2:21 PM, James Wright <balugajames at gmail.com> wrote: > I have some Java methods which return time elements and or Maps and I was > trying to convert these into XQuery atomic values with no luck. Is there a > utility for these? > > Array has ``fromValues`` and all other types like ``Str`` have ``get`` but > Map, Tim, Dtn, ADate do not appear to be construct-able. > > Any help would be appreciated. > - James
JW
James Wright30 Oct 2015 15:21 #
I have some Java methods which return time elements and or Maps and I was trying to convert these into XQuery atomic values with no luck. Is there a utility for these?
Array has ``fromValues`` and all other types like ``Str`` have ``get`` but Map, Tim, Dtn, ADate do not appear to be construct-able.
Any help would be appreciated.
- James
Written for BaseX 8.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery