
dls:document-update( $uri as xs:string, $doc as node(), $annotation as item()*, $retain-history as xs:boolean, [$permissions as item()*], [$collections as xs:string*], [$quality as xs:integer?], [$forest-ids as xs:unsignedLong*] ) as xs:string*
This function updates the managed document at the specified URI
with the specified contents. This function does an implicit
dls:document-purge
and returns the URI of any version of the document purged as
the result of the established retention policy.
dls:document-checkout
and
dls:document-checkin
functions.
You must first check out the document
with
dls:document-checkout
before you can update,
otherwise an exception is thrown. If the document does not exist, then an
exception is thrown.
dls-user role is required to run
this function, or the privilege:http://marklogic.com/xdmp/privileges/dls-user
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
let $bazbook :=
<BOOK>
<TITLE>Baz Goes to the Disco</TITLE>
<CHAPTER1>
<TITLE>Baz Wakes Up</TITLE>
<PARA>
Baz woke up this afternoon to the sound of James Brown. Soon
Baz was feeling a little funky, so he put on his cleanest
propeller hat and headed out in search of a Disco.
</PARA>
</CHAPTER1>
</BOOK>
return
dls:document-update(
"/foo/bar/baz.xml",
$bazbook,
"Changed the title from Baz Feelin' Funky",
fn:true())
(: Updates the contents of 'baz.xml'. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.