Probably a bug: replace value of node

Monday, 14 February 2011 · 3 messages
AM
Artur Moor14 Feb 2011 09:25 #

Hi all,

following the documentation on http://docs.basex.org/wiki/Update the instruction of:

replace value of node /doc with <new-element/>

on db:

<doc>
  <node/>
</doc>

should result in:

<doc>
  <new-element/>
</doc>

but the result is: <doc/>

LK
Lukas Kircher14 Feb 2011 09:59 #

Hey Artur,

thanks for the report - I'll take a look at this today and get back to you as soon as I can.

Regards, Lukas

On Mon, Feb 14, 2011 at 9:25 AM, Artur Moor <skynexion at googlemail.com>wrote:

Quoted text · Artur Moor · 26 lines
> Hi all, > > following the documentation on http://docs.basex.org/wiki/Update the > instruction of: > > replace value of node /doc with <new-element/> > > on db: > > <doc> > <node/> > </doc> > > should result in: > > <doc> > <new-element/> > </doc> > > but the result is: > <doc/> > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
LK
Lukas Kircher14 Feb 2011 12:22 #

Hi Artur,

I just found out this all comes down to a mistake in our XQuery Update documentation - I'm sorry to cause that confusion.

The XQuery Update specification says this:

If you have an expression like ... *'replace value of node A with B'* the expression *B* is evaluated with a text node constructor. That means the result of *B *is either a sequence of text nodes or an empty sequence.

Considering your example the outcome is valid - it's the documentation which is wrong. It's simply not possible to replace the *value of* an element node (its descendants) with other elements. I'll take care of this inconsistency.

Hope this clears things up, thanks for pointing that out!

Regards, Lukas

PS: I'm also forwarding your answer to basex-talk

On Mon, Feb 14, 2011 at 12:05 PM, Artur Moor <skynexion at googlemail.com>wrote:

Quoted text · Lukas Kircher · 52 lines
> It seems that the instruction: > > replace value of node $doc with $value > > replaces the content of $doc with atomic contents of given $value. I'm > not familiar with XQUF, but following the documentation on > http://docs.basex.org/wiki/Update it should replace the content of > $doc with given item(s) in $value. > > Is there a mistake in documentation or implementation? > > Regards, Artur > > 2011/2/14 Lukas Kircher <lukaskircher1 at googlemail.com>: > > Hey Artur, > > thanks for the report - I'll take a look at this today and get > > back to you as soon as I can. > > Regards, > > Lukas > > > > > > On Mon, Feb 14, 2011 at 9:25 AM, Artur Moor <skynexion at googlemail.com> > > wrote: > >> > >> Hi all, > >> > >> following the documentation on http://docs.basex.org/wiki/Update the > >> instruction of: > >> > >> replace value of node /doc with <new-element/> > >> > >> on db: > >> > >> <doc> > >> <node/> > >> </doc> > >> > >> should result in: > >> > >> <doc> > >> <new-element/> > >> </doc> > >> > >> but the result is: > >> <doc/> > >> _______________________________________________ > >> BaseX-Talk mailing list > >> BaseX-Talk at mailman.uni-konstanz.de > >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > > >

⚡Generated with XQuery