Loading TOC...

tde.validate

tde.validate(
   templates as node[],
   [excludeTemplateURIs as String[]]
) as Object

Summary

In addition to xdmp.validate that can be used for validating against the extraction template schema.

The recommended workflow for users is to validate an extraction template before inserting it into the schema database. Unless you use the tde.templateInsert function, Ill-formed templates are not validated or rejected at document insertion time.

For more information on extraction templates, see Template Driven Extraction (TDE) in the Application Developer's Guide.

Parameters
templates The templates to validate.
excludeTemplateURIs A sequence of URIs for stored templates to ignore during the validation. When a template is being updated, users can exclude a previous version of the template that might conflict with the version passed to tde.validate.

Usage Notes

The tde.validate function enables users to do the following:

Example

var t1= xdmp.toJSON(
{
  "template":{
    "context":"/Citation/Article/Journal/Details",
    "rows":[
      {
        "schemaName":"Medical",
        "viewName":"Publications",
        "columns":[
          {
            "name":"ID",
            "scalar-type":"BAD_SCALAR_TYPE",
            "val":"../../../ID"
          }
        ]
      }
    ]
  }
}
);

tde.validate([t1],["previous_version_of_t1.xml"]);

=>

{
"valid": false,
"error": "TDE-INVALIDTEMPLATENODE",
"message": "TDE-INVALIDTEMPLATENODE: Invalid extraction template node: fn:doc('')/tde:template/tde:rows/tde:row/tde:columns/tde:column[1]/tde:scalar-type"
}

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