[MarkLogic Dev General] Using xdmp:replace to replacing empty
node?
Eric Palmitesta
eric.palmitesta at utoronto.ca
Wed Feb 11 08:19:06 PST 2009
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
More information about the General
mailing list