tde.validate( templates as node[], [excludeTemplateURIs as String[]] ) as Object
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.
The
tde.validate
function enables users to do the following:
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" }