Fully enable the XML catalog resolver
Note: This item was included in a version of the DITA-OT and is no longer under discussion. Up to date information on the toolkit can be found here: The DITA Open Toolkit
Issue owner:
Primary editor of this document.
Stephen Zhang
Statement of problem or objective:
In DITA Open Toolkit, there is a xml catalog file "catalog-dita.xml" to help the processor find the required DTD files to validate the input DITA files. But the logic of parsing xml catalog file is simple and only supports the catalog tags that are currently used in "catalog-dita.xml".
Is this architecture, function, fix, or other?
It is a fix to support standard xml catalog file.
Goals of this proposal:
When the fix is applied to the toolkit, we will utilize the standard catalog resolver provided by xml-common project at apache.org
Use cases:
(get from proposal document)
Stakeholders:
List of those who request or need the proposed item.
Interested parties:
Deborah Pickett (deborah UNDERSCORE pickett AT moldflow.com )
There are two ways for the implementation of this item.
- If we can include the resolver.jar in the delivery package of DITA Open Toolkit, we can make org.apache.xml.resolver.tools.CatalogResolver as the default entity resolver in JAVA module and abandon the original code.
- If we cannot include resolver.jar in DITA Open Toolkit package, we can make a condition in JAVA code to see whether org.apache.xml.resolver.tools.CatalogResolver is available and then decide to use original code or the standard resolver.
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
if (catalogMap.get(publicId)!=null){
File dtdFile = new File((String)catalogMap.get(publicId));
return new InputSource(dtdFile.getAbsolutePath());
}
return null;
}
In this method, we call our internal implementation of catalog resolver. catalogMap is a hashmap which contains the mapping we get from catalog file. By using standard solution, we will use org.apache.xml.resolver.tools.CatalogResolver and set the instance of this class as the EntityResolver. We can add a sentence to do this in the constructor of DitaWriter. reader.setEntityResolver(new CatalogResolver());
Also in class DebugAndFilterModule, we need to set the system property "xml.catalog.files". This property will tell the CatalogResolver where to find the catalog file. So in DebugAndFilterModule we need to get ditadir (root directory of the open toolkit. The catalog file is at the root directory of the toolkit.). And in ant script we need to pass in the root directory when calling DebugAndFilterModule.
Here is an example:
<pipeline message="Debug and filtering." module="DebugAndFilter"
basedir="${basedir}" tempdir="${dita.temp.dir}"
extparam="ditadir=${dita.dir};inputdir=${user.input.dir}" />
Note: All design discussions should occur on the dita-ot-developer list at the dita-ot sourceforge site. Don Day – Thu, 27/04/2006 – 18:29 add new comment
- Login to post comments
- 8851 reads