Loading TOC...

xdmp:document-set-property

xdmp:document-set-property(
   $uri as xs:string,
   $prop as element()
) as empty-sequence()

Summary

Sets a property on a document. If any properties with the same property QName exist, they are replaced with the new property. If no properties exist with the same QName, the new property is added.

Parameters
$uri The document URI for the property setting.
$prop The property to set.

Example

xdmp:document-set-property(
  "http://marklogic.com/a/example.xml",
  <priority xmlns="http://example.com">5</priority>)

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • Confused. Firstly, I've never seen elements referred to as "properties", so are we talking about properties or elements? It accepts an xs:element and the examples looks like an element. But I'm trying to learn ML and maybe there's such thing as a property that's external to the document itself, like the URI. That confusion is compounded by the fact that running a quick test function in q console on a document in my database produces: "your query returned an empty sequence" However the document is unchanged. I assume no function should ever complete unsuccessfully without alerting me via an exception. So did I just change some property "outside" of the document? This is documentation written for people who already know the answer. Now, what Microsoft do with their documentation (which isn't perfect, but the best I've seen) is to always include a link to the related concepts at the bottom of the page, so you could have links for concepts and use-cases: "Manipulating XML documents" "Working with document metadata (Document Properties)" "How to set a single element value in a document"
    • Hi Luke. MarkLogic allows for properties fragments, which are indeed outside of the document, but associated with it. A properties fragment contains elements. For more details about Properties Fragments, please see this section of the Application Developer's Guide: http://docs.marklogic.com/guide/app-dev/properties#id_19516