update expression

Tuesday, 22 July 2014 · 2 messages
IK
Ioannis Kavvouras22 Jul 2014 15:57 #
Hello, I've tried to use the update expression (http://docs.basex.org/wiki/Updates#update) in basex releases after 7.8, but it always throws the exception: --- code --- - XQJQS001 - Invalid XQuery syntax, syntax does not pass static validation. - Root Cause: - net.xqj.basex.bin.bx: Encountered " <QNameToken> "update "" -------------- I try to run the simple xquery: for $ft in /server return $ft update delete node $ft/formal Regards Yannis PS: the copy expression cannot be used inside a for loop , is it?
DK
Dirk Kirsten22 Jul 2014 16:07 #
Hello Yannis, As stated in the documentation you linked to the "update" operator is currently BaseX specific (to simplify transform operations) and not part of the standard. As it seems you are using XQJ to access BaseX, it will just be able to parse valid XQuery 3.0 - So you will have to use the longer "copy modify return" form. The copy expression can be used inside a for loop, there is no restriction here. So something like
for $ft in /server
let $node := copy ... modify ... return
return doSomething($node)
would work. If you want to modify something multiple times you have to do it the other way round, i.e. putting the for loop inside your modify clause Cheers, Dirk
Quoted text · Ioannis Kavvouras · 21 lines
On 22/07/14 15:57, Ioannis Kavvouras wrote: > Hello, > > I've tried to use the update expression > (http://docs.basex.org/wiki/Updates#update) in basex releases after 7.8, > but it always throws the exception: > --- code --- > - XQJQS001 - Invalid XQuery syntax, syntax does not pass static validation. > - Root Cause: > - net.xqj.basex.bin.bx: Encountered " <QNameToken> "update "" > -------------- > > I try to run the simple xquery: > for $ft in /server > return $ft update delete node $ft/formal > > Regards > Yannis > > > PS: the copy expression cannot be used inside a for loop , is it?
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22

⚡Generated with XQuery