Hi Marc,

This was a deliberate restriction: As maps and arrays are function
items, and as they can contain references to other functions that have
been declared in the evaluated query, it is generally tricky to
evaluate and return them dynamically.

However, I spent some more thoughts on the underlying semantics, and I
may have found a solution that overcomes some of the earlier
limitations.

A new snapshot is available [1], which now allows you to return
function items (incl. maps and arrays) as result of xquery:eval. Your
testing feedback will be welcome.

Christian

[1] http://files.basex.org/releases/latest/



On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel
<marc.van.groo...@gmail.com> wrote:
> Hi,
>
> I'm trying to return a map or an array from xquery:eval. Seems this is
> not possible, yet the signature says it returns item()*
>
>     xquery:eval('1 + 1') => 2
>     xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*)
> have no string representation.
>     xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of type
> map(*) have no string representation.
>
> BTW: I saw that xquery:eval#3 is documented as returning item() while
> the other arities return item()*
>
> Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro I 
> figure.
>
> --
> --Marc

Reply via email to