Loading TOC...


   $entity-document as Node
) as Sequence


Extract an in-memory entity instance from its envelope document as a JavaScript object.

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

Usage Notes

Use this function to get an in-memory instance representation from an envelope document that contains canonical instance data within es:instance elements. An envelope document is usually created using the extract instance function in an instance converter module created by the Entity Services API.

An in-memory instance contains nested objects if those objects were persisted as nested XML elements. This function returns a sequence of one or more instances, as JavaScript objects.

To extract an entity from an envelope document as an XML node, use es.instanceXmlFromDocument instead. To extract an entity from an envelope document as a JSON object, use es.instanceJsonFromDocument instead.

See Also


/* Assume /es-gs/env/1234.xml is an envelope document with
 * the following contents:

  <es:envelope xmlns:es="http://marklogic.com/entity-services">
        <fullName>George Washington</fullName>

const es = require('/MarkLogic/entity-services/entity-services');

/* Returns the following, as a JavaScript object
  { "$type": "Person",
    "fullName":"George Washington"

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