32. validateHook
Prev | Chapter 7. Configuration elements | Next

## 32. 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` (implements interface `com.xmlmind.xmleditapp.validatehook.ValidateHook` -- SeeChapter 6, Writing a validateHook in XMLmind XML Editor - Developer's Guide).

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 `validateHook`s cannot be removed or replaced.

  When a `validateHook` element is used to remove 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 `tgroup`s and `entrytbl`s (if needed to) just before a DocBook document is checked for validity.

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

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

Prev | Up | Next
31. validate | Home | 33. windowLayout