How to re-map external entities?

XMLProbe can replicate the behaviour of org.xml.sax.EntityResolver and so substitute an external entity specified by the governing DTD for another, user-specified one.

Reasons for re-mapping of external entities include:

For each entity to be re-mapped, set a http://xmlprobe.com/features/remap-entity feature, using appropriate from and to values, for the QA handler your ruleset uses, e.g.

...
<probe:addIn xmlns:probe="http://xmlprobe.com/200312">
<probe:name>com.xmlprobe.QAHandler</probe:name>
<probe:config>
<probe:feature>
<probe:name>http://xmlprobe.com/features/remap-entity</probe:name>
<probe:from>http://foo-bar-blort.org/the-official.dtd</probe:from>
<probe:to>C:\my\local\copy\of\the-official.dtd</probe:to>
</probe:feature>

<!--more re-mappings here...-->

</probe:addIn>
...

Important

  • Typically the from and to values will be URLs. The from value must match the absolute form for that given in the DTD for substitution to be possible. Note that this means for entities accessed as part of the local file system, a fully-qualified path (beginning file:///) is required. This URL must be specified using the conventions specific to the system where XMLProbe is installed (e.g. upper/lower case on Win32 systems is significant).

  • If XMLProbe cannot access the document at the from URL value, the re-mapping operation fails and the failure is not reported.

  • If XMLProbe finds the document at the from URL value, but cannot locate the document at the to URL value, a FATAL error is reported, where the omission of the substituted entity would result in the document not being well-formed.