es.modelFromXml( model as Node ) as Object
This function is deprecated and will be removed in a future release.
Create a basic model from an XML model descriptor, without validating
the input descriptor for correctness.
Parameters | |
---|---|
model |
A valid XML model descriptor, as an es:model element or
as a document with an es:model element as its root.
|
Use es.modelValidate to validate the descriptor while creating a basic model
There is no equivalent to this function for JSON because the JSON representation of a valid model descriptor is identical to the corresponding basic model.
// Create basic model from an XML model descriptor stored in the database. const es = require('/MarkLogic/entity-services/entity-services'); const modelDesc = fn.doc('/descriptors/name.xml'); es.modelFromXml(modelDesc); /* Result: A basic model, as an Object. For example: { "info": { "title": "Example", "version": "1.0.0" }, "definitions": { "Name": { "properties": { "first": { "datatype": "string" }, "middle": { "datatype": "string" }, "last": { "datatype": "string" } }, "required": [ "first", "last" ] } } } */