I do not seem to be able to update/modify a DOM and return it using the same query. BaseX complains about update not being possible at that context...
let $x := <root/> return (insert node <x/> into $x, $x)
Is there a way to update and return the DOM using one query or is that not handled by xquery in general?
Hi Erdal,
in xquery it's not possible to combine read queries (returning a result) and update queries in one query.
Kind regards, Andreas
Erdal Karaca schrieb:
I do not seem to be able to update/modify a DOM and return it using the same query. BaseX complains about update not being possible at that context...
let $x := <root/> return (insert node <x/> into $x, $x)
Is there a way to update and return the DOM using one query or is that not handled by xquery in general?
-- 1 + 1 = 10
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Sorry, I forgot to add basex-talk as a receiver, so here we go again ...
Sorry for the inconvenience, but BaseX does not support updating DOM nodes out of the box. But using the transform enables you to bypass the problem:
let $x := ( copy $c := <root/> modify (insert node <x/> into $c) return $c ) return $x
There's also a section dedicated to this detail on our website [1].
As Andreas stated earlier XQuery also doesn't allow to mix up updating and non-updating expressions. If you want to use the $x variable at a later point the solution above helps. Otherwise you can omit the variable declaration and directly return results of the transform expression.
Hope this helps, regards, Lukas
[1] http://www.inf.uni-konstanz.de/dbis/basex/xquery#update
On Sep 23, 2010, at 9:54 AM, Andreas Weiler wrote:
Hi Erdal,
in xquery it's not possible to combine read queries (returning a result) and update queries in one query.
Kind regards, Andreas
Erdal Karaca schrieb:
I do not seem to be able to update/modify a DOM and return it using the same query. BaseX complains about update not being possible at that context...
let $x := <root/> return (insert node <x/> into $x, $x)
Is there a way to update and return the DOM using one query or is that not handled by xquery in general?
-- 1 + 1 = 10
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de