Loading TOC...

MarkLogic 10 Product Documentation
tde:validate

tde:validate(
   $templates as element(tde:template)*,
   [$excludeTemplateURIs as xs:string*]
) as map:map

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:template-insert 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

xquery version "1.0-ml";

let $t1:=
<template xmlns="http://marklogic.com/xdmp/tde">
  <context>/Citation/Article/Journal/Details</context>
  <rows>
    <row>
      <schema-name>Medical</schema-name>
      <view-name>Publications</view-name>
      <columns>
        <column>
          <name>ID</name>
          <scalar-type>BAD_SCALAR_TYPE</scalar-type>
          <val>../../../ID</val></column>
      </columns>
    </row>
  </rows>
</template>

return tde:validate(($t1),("previous_version_of_t1.xml"))

=>

<map:map xmlns:map="http://marklogic.com/xdmp/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <map:entry key="valid">
    <map:value xsi:type="xs:boolean">false</map:value>
  </map:entry>
  <map:entry key="error">
    <map:value xsi:type="xs:string">TDE-INVALIDTEMPLATENODE</map:value>
  </map:entry>
  <map:entry key="message">
    <map:value xsi:type="xs:string">TDE-INVALIDTEMPLATENODE: Invalid extraction template node: /tde:template/tde:rows/tde:row/tde:columns/tde:column/tde:scalar-type</map:value>
  </map:entry>
</map:map>

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