Aliases

The <actf:aliases> element lists the aliases that are to be used in the document rulebase. There can be only one set of aliases and it must appear as a <actf:aliases> child element of the <actf:metadata> element. An alias contains a name-value pair, the name specifying a token that is to be used in place of the value in the validation document.

With aliasing, the ACTF validation engine substitutes the value of the alias for the name corresponding to that value in the list of aliases during processing. This substitution can occur in one of two places:

  1. In tag names.
  2. In values of attributes.

In the latter case, the alias name is prefixed with a percent sign (%) in order to indicate that the attribute value is to be interpreted by ACTF as an alias name rather than as a literal. (Future work will include making it possible to reference resource bundles using this notation as well.)

For instance, consider the alias definition:


<actf:alias
   actf:name="Button"
   actf:value="javax.swing.JButton"
/>

Given this alias definition, when an element with the name Button is encountered, ACTF uses the alias value for that token, javax.swing.JButton. Thus, any <Button> tag is actually read by ACTF as a <javax.swing.JButton> tag. If we wanted to use the alias name in an attribute value, we would write:

<...<some_attr_name>="%Button"...>

to point to the value of the alias. The ACTF Validation Core plug-in and Java Validation Core plug-in's resources directories contain model specific configuration XML files for each model supported by ACTF that define many aliases that permit one to use more concise names to refer to commonly used Java classes so that, for example, we are able to write Button instead of javax.swing.JButton or Frame instead of javax.swing.JFrame. Individual aliases defined in a validation document within the <actf:aliases> tag have precedence over those defined in model configuration files.