7. documentHook

<documentHook
  name = non empty token
>
  Content: [ class ]?
</documentHook>

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

Register documentHook specified by class with XXE.

A documentHook is some code notified by XXE each time a document is created, opened, checked for validity, saved to disk and closed.

This is a very general mechanism which has been created to perform semantic validation beyond what can be done using a DTD or XML-Schema alone but which can also be used to perform many other tasks. See Chapter 9, Writing a documentHook in XMLmind XML Editor - Developer's Guide.

Child elements of documentHook:

class

Register documentHook implemented in the Java™ language by class class (implements interface com.xmlmind.xmleditapp.dochook.DocumentHook -- SeeChapter 9, Writing a documentHook in XMLmind XML Editor - Developer's Guide).

Attributes of documentHook:

name

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

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

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

<documentHook>
  <class>com.xmlmind.xmleditapp.docbook.DocumentHookImpl</class>
</documentHook>

A documentHook is always specific to a document type.

For example, the DocBook documentHook is used to fix the cols attribute of tgroups and entrytbls (if needed to) just before a DocBook document is saved to disk.

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

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