Nice, Christian. This works!

Unfortunately I have to come up with the next question.
What if I want to do the same from Java?
If from inside an xquery I call a Java extension of mine passing a node (eg: <a/>) as an argument I get the value passed as org.basex.api.dom.BXElem.
If I wanted, from inside that Java code, to make a client call towards another basex server I again get the exception because of casting from string to node().
I think my problem is that the bind method of class ClientQuery checks for the value Object being an instance of org.basex.query.value.Value.
If it is not and the type is not specified, it serializes the value parameter with toString() which for dom elements like <a/> turns into the string "[a:null]".
Unfortunately I'm not able to understand how to transform a org.basex.api.dom.BXNode|BXElem into a org.basex.query.value.Value or possibly specify a type for it in order to make the bind method handle it correctly.
Could you please help me out of this?

Thank you very much.
Marco.



On 03/11/2014 15:23, Christian GrĂ¼n wrote:
Hi Marco,

I have fixed this inconsistency in the latest snapshot [1].

Thanks,
Christian

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


On Mon, Nov 3, 2014 at 12:06 PM, Marco Lettere <marco.lettere@dedalus.eu> wrote:
Hi all,
I'm not able to provide myself an answer to the fact that the first query
returns an exception (cannot cast string to node) whereas the second works
perfectly.

client:connect("localhost", 1984, "admin", "admin") !
  client:query(., "declare context item as node() external; .", {"" :=
<a/>})


client:connect("localhost", 1984, "admin", "admin") !
  client:query(., "declare variable $x as node() external; $x", {"x" :=
<a/>})

I understand that the context is serialized as a string but isn't it the
possibility to pass the type information along with the query and avoid
explicit serialization on the client and deserialization on the remote
server as it happens with variables?

Thanks,
Marco.