34. validateHook

<validateHook
  name = non empty token
>
  Content: [ class [ property ]* ]?
</validateHook>

<class>
  Content: Java class name
</class>

<property
  name = NMTOKEN matching [_a-zA-Z][_a-zA-Z0-9]*
  type = (boolean|byte|char|short|int|long|float|double|
          String|URL)
  value = string
/>

Register validateHook specified by class with XXE.

A validateHook is some code notified by XXE before and after a document is checked for validity.

This is a very general mechanism which has been created to perform semantic validation beyond what can be done using a DTD or a schema alone.

Child elements of validateHook:

class

Register validateHook implemented in the Java™ language by class class (which itself implements interface com.xmlmind.xmleditapp.validatehook.ValidateHook -- SeeChapter 5, Custom validation hook).

property

Property child elements may be used to parametrize a newly created validateHook. See bean properties.

Attributes of validateHook:

name

This name is useful to remove or replace a previously registered validateHook. Anonymous validateHooks cannot be removed or replaced.

When a validateHook element is used to discard a registered validateHook, a name attribute must be specified and there must be no class child element.

Example: In this example, a Java™ class named com.xmlmind.xmleditext.docbook.table.ValidateHookImpl is contained in docbook.jar (among other DocBook commands and extensions).

<validateHook>
  <class>com.xmlmind.xmleditext.docbook.table.ValidateHookImpl</class>
</validateHook>

A validateHook is always specific to a document type.

For example, the DocBook validateHook is used to fix the cols attribute of tgroups and entrytbls (if needed to) just before a DocBook document is checked for validity.

These validateHooks are specified in the XXE configuration file associated to the document type. For example, the DocBook validateHook is specified in docbook.xxe.

Several validateHooks can be associated to the same document type. In such case, they are notified in the order of their registration.