A validation hook is some code written in Java™ notified by XXE before and after a document is checked for validity. A document is checked for validity on demand (menu item → ) but also automatically, after just being opened and before being saved to disk.
This mechanism has been created to perform semantic validation beyond what can be done using a DTD or schema.
In some cases, an alternative to writing a validation hook in Java™ is to write a Schematron and declare it in the configuration file by the means of a schematron configuration element in XMLmind XML Editor - Configuration and Deployment.
A validation hook is declared in an XXE configuration file by the means of the validateHook configuration element in XMLmind XML Editor - Configuration and Deployment. DITA topic example:
<validateHook name="checkTopicId"> <class>com.xmlmind.xmleditext.dita.CheckTopicId</class> </validateHook>
Implement interface ValidateHook. The ValidateHook interface is simple and straightforward:
| Method | Description |
|---|---|
checkingDocument | Invoked before a document conforming to a schema is validated. Therefore validation hooks automatically fixing problems in the document being edited must implement method |
documentChecked | Invoked after a document conforming to a DTD or schema has been validated. Therefore validation hooks reporting semantic errors must implement method |