Validation Rule Basics

The basis for any ACTF validation process are the validation rules. The validation rules specify the types of objects to be checked and the constraints according to which these objects are to be verified. Validation rules may be conditionally enabled by use of the actf:enable attribute (which is set to true by default). This feature makes it easy for you to control the types of validation rules that are applied without maintaining multiple validation documents. It can also be helpful if you temporarily want to suppress checks that may be triggered.

The classes of components to be validated appear as children of the <actf:ruleset> element. Elements that comprise rules are children of these elements. (Future work will permit more general criteria other than only the type of an element to be specified.)

Consider the following specification of a constraint for a java.util.List:


<?xml version="1.0"?>
:
<actf:ruleset...>
:
  <org.w3c.dom.Element>
    <tagName actf:regexp="[a-zA-Z]+"/>
    <attribute actf:param="id"/>
  </org.w3c.dom.Element>
:
<actf:ruleset>
:

In this simple example, we are asking the ACTF validation engine to simply verify that each object that is an instance of org.w3c.dom.Element has a tag name that matches the given regular expression (i.e. is made up of only alphabetic characters) and has a nonnull id attribute. Other relations that may be tested can be specified using the attributes actf:min and actf:max or actf:range to specify a range, the actf:eq to test for equality, or the actf:neq which tests for non-equality.

Two other common attributes of rules, actf:severity and actf:message, are also available. These attributes are used to specify the severity of a failure of a property to satisfy a constraint and the message printed as a result of that failure. Possible values for the actf:severity attribute include ERROR, WARNING, and INFO. If the actf:message attribute is not present, a default message is printed by ACTF.