Loading TOC...


   $instance as map:map,
   $namespace as xs:string,
   $namespace-prefix as xs:string
) as map:map


This function is deprecated and will not be supported in MarkLogic 11.
A utility function used to decorate an XML instance with namespace information during extraction.

$instance The instance to be annotated with namespace information.
$namespace The namespace URI to be added to the instance.
$namespace-prefix The namespace prefix to be bound to namespace URI.

Usage Notes

You will not usually call this function outside of code generated by Entity services. The generated code uses this function to decorate an instance with namespace URI and prefix information derived from the model. The generated code only invokes this function for entity types that declare a namespace and namespace prefix.

See Also


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

let $raw := fn:doc('/es-gs/raw/1234.xml')
let $instance := es:init-instance(es:init-source($raw, 'Person'), 'Person')
return es:with-namespace($instance, 'http://marklogic.com/entity-services/getting-started','esgs')

(: Returns an initialized instance similar to the following:
 : { "$type":"Person", 
 :   "$namespace":"http://marklogic.com/entity-services/getting-started", 
 :   "$namespacePrefix":"esgs"
 : }

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