XML technologies / DITA / DITA Open Toolkit / XML catalogs

(Excerpt from “DITA – Der neue Standard für Technische Dokumentation” by Johannes Hentrich)

Every DITA XML file contains a DOCTYPE declaration in which a public identifier (public identifier) references the corresponding topic type through a module file or DTD. The public identifier lets an XML catalog locate a DTD or module file on the local disk. It thus specifies which DTD or module file should validate the structure of the corresponding topic.

The following example shows a DOCTYPE declaration for a task topic:

<!DOCTYPE task PUBLIC "-//OASIS//ELEMENTS DITA Task//EN" "../dtd/task.mod">

Here, task specifies the root element’s name. The public identifier is: PUBLIC "-//OASIS//ELEMENTS DITA Task//EN". It is followed by a system identifier, used if the public identifier is absent from the XML catalog and the DTD or module file therefore cannot be located through it.

The public identifier is mapped to its DTD or module file in the file catalog-dita.xml in the DITA Open Toolkit’s root directory. A DITA XML file’s DOCTYPE declaration therefore never needs changing when the file is moved or stored in any directory on the disk.

In the file catalog-dita.xml, catalog entries are inside the element <group>, defined as follows:

<group xml:base="dtd/">

The setting xml:base specifies where to find the DTDs or module files for subsequent catalog entries. A catalog entry is defined by an element <public>. The following example shows the entry required for a task topic.

<public publicId="-//OASIS//ELEMENTS DITA Task//EN" uri="task.mod"></public>

The attribute publicId contains the public identifier. The attribute uri specifies the path relative to the directory defined in the element <group>. This completes the mapping from the public identifier to the DTD or module file’s path.

Resolution (resolve) is performed by the XML catalog resolver included in the DITA Open Toolkit. It is a Java program in the toolkit’s lib directory and ensures that the correct DTD or module file is always found for the corresponding topic.

If you use only DITA’s standard topics, you will hardly encounter the XML catalog or the file catalog-dita.xml. This changes once you work with specialized information structures and their DTDs, module files and entity files.

Each specialized topic type gets a new DTD and module file. Specializing a domain creates a new module file and entity file. These specialized DTDs, modules and entity files must be referenced through a public identifier.

A public identifier’s format is defined as follows:

 -//Besitzer//Beschreibung//Sprache 

The Support topic specialized in Specialization was given the following public identifier:

 -//JH//DTD DITA support//DE 

This public identifier is used to update the following two XML catalog files:

The DITA Open Toolkit can then work with the specialized information structures.

The file dita-catalog-template.xml is in the toolkit’s root directory. The two entries for the specialized Support topic type, that is, the specialized module file and shell DTD, are:

<public publicId="-//JH//DTD DITA support//DE" uri="c:/ditaot14/dtd/support.dtd"></public>
<public publicId="-//JH//ELEMENTS DITA support//EN" uri="c:/ditaot14/dtd/support.mod"></public>

When production starts through an ANT build file, the contents of the file catalog-dita.xml are updated: new entries from the file dita-catalog-template.xml are copied into the file catalog-dita.xml.

Besides the file dita-catalog-template.xml, another catalog file must be extended: the ANT catalog file ant-catalog.xml. It is also in the toolkit’s root directory. The syntax in the file ant-catalog.xml differs somewhat from that in the file dita-catalog-template.xml. Nevertheless, both files must contain the same number of entries.

For the specialized Support topic type, the two entries in the file ant-catalog.xml are as follows:

<dtd publicId="-//JH//DTD DITA support//DE" location="2${dita.dtd.dir}${file.separator}dtd${file.separator}support.dtd" />
<dtd publicId="-//JH//ELEMENTS DITA support//DE" location="2${dita.dtd.dir}${file.separator}dtd${file.separator}support.mod" />

The attribute publicId defines the public identifier. The path to the specialized DTD and module file is specified in the attribute location, where dita.dtd.dir and file.separator are variables whose values have already been set.

Defining the two catalog files dita-catalog-template.xml and ant-catalog.xml completes all entries, allowing the new DTDs, module files and entity files to be located during processing.

  

 

 

 

back to top