This file contains a short description of the DTD used for saving/loading Value Constarints in ClarkSystem. There is one example XML document which represents the serialization of one Value Constraint from the system.

<!DOCTYPE CLaRK_value_constraints [

<!ELEMENT CLaRK_value_constraints (comment?,constraint+)>

The file contains a collection of value constraints. There can be a preceding comment element which is not precessed by the system.

<!ELEMENT comment (#PCDATA)>

Free text comment before the constraints descriptions.

<!ELEMENT constraint (name, descr?, targetTag, targetAttr?, targetRestr?, filter?, tokenizer?, source, externalDoc?, helpDoc?, templates?, counter?)>

This represents the serialized form of one Value Constraint. Here is the description of each of its sub-elements:

- name – unique identifier for this constraint in the system;
- descr – optional free text description of the constraint;
- targetTag – the tags to which the constraint will be applied;
- targetAttr – the attributes to which the constraint will be applied (if it is a SOME_ATTRIBUTES constraint)
- targetRestr – additional restriction over the target nodes (XPath expression)
- filter – a filter to be used when preparing source with tokens;
- tokenizer – a tokenizer to be used when preparing source with tokens;
- source – the source expression depending on the constraint type (XML data or XPath expression)
- externalDoc – the document from which the source will be retrieved (if external source). The document must be internal for the system;
- helpDoc – the document containing the help data. The document must be internal for the system;
- tempaltes - a list of templates used for further token value restriction;
- counter - a counter, used for making backups at constraint run-time.

<!ATTLIST constraint
active (y|n) #IMPLIED

type (parent|some_children|all_children|some_attribute) #REQUIRED
showBefore (y|n) #REQUIRED
showAfter (y|n) #REQUIRED
skipICheck (y|n) #REQUIRED
>

Attributes description:

active - a flag showing if the constraint is active or not in the system. This attribute is optional. The default is not active constraint;
- type
- an identifier for the type of the constraint. The following values are allowed: parent, some_children, all_children, some_attribute. Other value for this attribute will cause an error and the whole constraint will not be loaded;
showBefore - if the constraint will show information before its application;.
showAfter - if the constraint will show information after its application;
- skipICheck - if the constraint should skip the intersection check while applying a constraint;

<!ELEMENT name (#PCDATA)>

<!ELEMENT descr (#PCDATA)>

<!ELEMENT targetTag (#PCDATA)>

<!ELEMENT targetAttr (#PCDATA)>

<!ELEMENT targetRestr (#PCDATA)>

<!ELEMENT filter (#PCDATA)>

<!ELEMENT tokenizer (#PCDATA)>

<!ELEMENT source (#PCDATA)>

<!ATTLIST source
type (local_ doc|external_doc|xml_data) #REQUIRED>

This is the type of the source which the constraint will use. The only allowed values are: local_doc, external_doc, xml_data;

<!ELEMENT externalDoc (#PCDATA)>

<!ELEMENT helpDoc (#PCDATA)>

<!ELEMENT templates (item)+>

<!ELEMENT item (#PCDATA)>

<!ELEMENT counter (EMPTY)>

<!ATTLIST counter
number CDATA #REQUIRED>
]>

Example XML serialization of 2 Value Constraints:

<CLaRK_value_constraints>
<constraint active="y" showBefore="y" showAfter="n" type="some_attributes">
<name>my constraint name</name>
<descr>my free text description</descr>
<targetTag>constraint</targetTag>
<targetAttr>type</targetAttr>
<targetRestr>not(child::*)</targetRestr>
<tokenizer>MixedWord</tokenizer>
<source type="external_doc">/book/isbn</source>
<externalDoc>Xtest2.XML</externalDoc>
<helpDoc>helpFile.xml</helpDoc>
</constraint>
<constraint showBefore="n" showAfter="n" type="parent">
<name>my parent constraint name</name>
<descr>my free text description(optional)</descr>
<targetTag>filter</targetTag>
<targetRestr>not(parent::constraint)</targetRestr>
<source type="xml_data">&lt;constraint/&gt;&lt;comment/&gt;</source>
</constraint>
</CLaRK_value_constraints>