XML technologies / DocBook / XML catalogs / A first example

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

In the example “Structure of an XML catalog” you have already seen the structure of an XML catalog. Between <catalog> and </catalog> various XML elements are allowed, as listed in the following table. Attributes in bold are required; those in normal type are optional. Each element shown also allows the optional attributes id and xml:base. The former identifies the element; the latter changes the base URI (similar to HTML’s BASE element).

Table: Permitted entries in XML catalogs (version 1.0)

Element

Description/syntax

delegatePublic

identifies part of a public identifier and delegates the replacement process to another XML catalog

<delegatePublic publicIdStartString ="PUBLIC_IDENTIFIER_PRÄFIX" catalog="URI"/>

delegateSystem

identifies part of a system identifier and delegates the replacement process to another XML catalog

<delegateSystem systemIdStartString="STRING" catalog="URI"/>

delegateURI

identifies part of a URI and delegates the replacement process to another XML catalog

<delegateURI uriIdStartString="STRING" catalog="URI"/>

group

groups entries and specifies a base URI

<group prefer="public|system" > ... </group>

nextCatalog

loads another catalog

<nextCatalog catalog="URI"/>

public

identifies a complete public identifier

<public publicId="PUBLIC_IDENTIFIER" uri="URI"/>

rewriteSystem

identifies part of a system identifier and replaces it with a URI reference

<rewriteSystem systemIdStartString="STRING" rewritePrefix="URI"/>

rewriteURI

identifies part of a URI and replaces it with a URI reference

<rewriteURI uriIdStartString="STRING" rewritePrefix="URI"/>

system

identifies a complete system identifier

<system systemId="STRING" uri="URI"/>

uri

maps a URI to an alternative URI

<uri name="STRING" uri="URI"/>

Note: Difference between versions 1.0 and 1.1
Version 1.1 of the XML Catalogs specification has two new elements, systemSuffix and uriSuffix. Before using them in your catalog, check which version of the specification your XML parser supports.

The following example shows two of the most common elements, <public/> and <system/>:

 

Example: testCatalog.xml

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <public publicId="-//OASIS//DTD DocBook XML V4.5//EN" uri="file:///usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd" />
  <system systemId="http://www.beispiel.de/dtd/v2.3.4/bsp.dtd" uri="file:///usr/share/firms/beispiel/dtd/v2.3.4/bsp.dtd" /> 
  <nextCatalog catalog="file:///usr/local/doc/xsldbg/catalog.xml"/>
</catalog> 

The catalog above has the following properties:

  1. The public element maps the public identifier -//OASIS//DTD DocBook XML V4.5//EN to the path file:///usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd . Whenever this public identifier is requested, the catalog resolver returns the URI from the attribute uri.

  2. The system element maps the URL "http://www.beispiel.de/dtd/v2.3.4/bsp.dtd" to the path file:///usr/share/firms/beispiel/dtd/v2.3.4/bsp.dtd .

  3. Additional entries are read using nextCatalog. This element lets you organize your entries by topic.

Note: Notation under Windows
Under Windows, write paths with a forward slash (/) rather than a backslash (\). This means that the path C:\Programme\DocBook becomes C:/Programme/DocBook in the catalog file.

  

back to top