18.2. Using linkType to implement link validation

In order to use one or more linkType elements defined in a configuration file to perform link validation in addition to link navigation, you'll have to declare the following validateHook:

<validateHook>
  <class>com.xmlmind.xmleditapp.linktype.LinkChecker</class>
</validateHook>

By default, this validateHook checks all anchors and all links, and this for all the link types defined the configuration file. By default, the diagnostics reported by this validateHook are added to those reported by the validation performed by the DTD or schema. All these default behaviors may be changed by using the bean properties described below:

NameTypeDefaultDescription
excludedLinkTypesString (zero or more link type names separated by whitespace)"" (empty string)Do not check the anchor and links belonging to specified link types.
checkRefsbooleantrueIf true, check links which are direct references to anchors (that is, the equivalent of IDREF and IDREFS).
checkHrefsbooleantrueIf true, check links which are hrefs (that is, URI#anchor_name).
checkAnchorsbooleantrueIf true, check anchors (that is, the equivalent of ID).
replaceDiagnosticsbooleanfalseIf true, replace some of the diagnostics issued by the DTD or schema. For example, if checkAnchors is true, replace the duplicate ID error messages reported by the DTD or schema by the errors detected by this link checker.
checkIfMemberOfDocSetbooleanfalseIf true, check anchors and links, but only when the document being checked is part of a document set. This implies that when the document being checked is not part of the document set, the job done by the DTD or schema is sufficient.

An actual, commented, validateHook for DocBook 5:

<validateHook name="checkLinks">
  <class>com.xmlmind.xmleditapp.linktype.LinkChecker</class>

  <!-- Let the schema check IDs. We'll only check refs. -->
  <property name="checkAnchors" type="boolean" value="false" />

  <property name="replaceDiagnostics" type="boolean" value="true" />

  <!-- When the document is not a member of a set, the DTD is just fine
       to check IDREFs. -->
  <property name="checkIfMemberOfDocSet" type="boolean" value="true" />

  <property name="excludedLinkTypes" type="String" value="xml:id" />
</validateHook>