Loading TOC...

xdmp:document-get-metadata

xdmp:document-get-metadata(
   $uri as xs:string
) as map:map?

Summary

Returns the metadata value of a given document.

Parameters
$uri The document URI.

Example

(: Set some metadata on a document. :)
xquery version "1.0-ml";
xdmp:document-set-metadata("foo.xml",
  map:map() => map:with("someKey", "someValue")
            => map:with("someOtherKey", 123));

(: Fetch the metadata. :)
xquery version "1.0-ml";
xdmp:document-get-metadata("foo.xml")

(: Returns the metadata for the document, as a map. For example:
 :
 : <map:map xmlns:map="http://marklogic.com/xdmp/map" 
 :     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 :     xmlns:xs="http://www.w3.org/2001/XMLSchema">
 :   <map:entry key="someKey">
 :     <map:value xsi:type="xs:string">somevalue</map:value>
 :   </map:entry>
 :   <map:entry key="someOtherKey">
 :     <map:value xsi:type="xs:string">123</map:value>
 :   </map:entry>
 : </map:map> 
 :)

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