MarkLogic Server 11.0 Product Documentation
es:instance-xml-from-document

es:instance-xml-from-document(
   $entity-document as document-node()
) as element()*

Summary

This function is deprecated and will be removed in a future release.
Extract a canonical entity instance from its envelope document, as XML.

Parameters
entity-document An envelope document that contains canonical entity instance(s).

Usage Notes

Use this function to extract the canonical XML instance data from an envelope document. This function returns a sequence of XML elements, one per instance in the envelope document. If no instances are found, an empty sequence is returned.

See Also

Example

(: Assume /es-gs/env/1234.xml is an envelope document with
 : the following contents:
  <es:envelope xmlns:es="http://marklogic.com/entity-services">
    <es:instance>
      <es:info>
        <es:title>Person</es:title>
        <es:version>0.0.1</es:version>
      </es:info>
      <Person>
        <id>1234</id>
        <firstName>George</firstName>
        <lastName>Washington</lastName>
        <fullName>George Washington</fullName>
      </Person>
    </es:instance>
    <es:attachments>
      <person>
        <pid>1234</pid>
        <first>George</first>
        <last>Washington</last>
      </person>
    </es:attachments>
  </es:envelope>
:)

xquery version "1.0-ml";
import module namespace es = "http://marklogic.com/entity-services"
    at "/MarkLogic/entity-services/entity-services.xqy";

es:instance-xml-from-document(fn:doc('/es-gs/env/1234.xml'))

(: Returns a json:object (map:map) equivalent to the following JSON:

  <Person xmlns:es="http://marklogic.com/entity-services">
    <id>1234</id>
    <firstName>George</firstName>
    <lastName>Washington</lastName>
    <fullName>George Washington</fullName>
  </Person>
:)
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy