[MarkLogic Dev General] Using xdmp:replace to replacing empty node?

Michael Blakeley michael.blakeley at marklogic.com
Wed Feb 11 08:23:47 PST 2009


Eric's explanation is good. It's also useful to check the list archive 
material on this (or any) error message:

http://marklogic.markmail.org/search/?q=cannot+update+constructed+nodes

The thread http://markmail.org/thread/c5a3wqv2ukj3ugz5 (started by Eric) 
is pretty good place to start.

thanks,
-- Mike

On 2009-02-11 08:19, Eric Palmitesta wrote:
> I believe xdmp:node-replace only works on nodes in the database.  In
> other words, this won't work...
>
> let $x :=<hello/>
> let $y := xdmp:node-replace($x,<goodbye/>)
> return $x
>
> ...because I just constructed $x on the fly (in memory).
>
> This will work, though:
>
> let $x := doc('/path/to/file.xml')/xpath/to/hello
> (: assume $x is now<hello/>  :)
> let $y := xdmp:node-replace($x,<goodbye/>)
>
> Note xdmp:node-replace returns empty(), so in both cases $y will be (),
> I'm just using it to do some work.
>
> Cheers,
>
> Eric
>
> Schwartz, Christine wrote:
>> I wrote this post without enough coffee this morning.
>>
>> I meant xdmp:node-replace.
>>
>> Thanks,
>>
>> Chris
>>
>> Christine Schwartz
>> Metadata Librarian
>> Princeton Theological Seminary Libraries
>>
>>
>> ________________________________________
>> From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Schwartz, Christine
>> Sent: Wednesday, February 11, 2009 10:00 AM
>> To: general at developer.marklogic.com
>> Subject: [MarkLogic Dev General] Using xdmp:replace to replacing empty node?
>>
>> Hi,
>>
>> I am new to this list and new to XQuery and Mark Logic.
>>
>> Can I use xdmp:replace on an empty node:<dc:relation/>?
>>
>> I'm getting the error message "Cannot update constructed nodes."
>>
>> I've used this function before to without any problem.
>>
>> Thanks,
>>
>> Chris
>>
>> Christine Schwartz
>> Metadata Librarian
>> Princeton Theological Seminary Libraries
>> christine.schwartz at ptsem.edu
>> (609) 497-7938
>>
>>
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general



More information about the General mailing list