Chapter 3. XML Catalogs

Table of Contents

3.1. About XML Catalogs
3.2. The XML Catalog Hierarchy
3.2.1. The Root Catalog: /etc/xml/catalog
3.2.2. Package Catalogs: /etc/xml/package.xml
3.2.3. Local Catalogs: /usr/share/xml/.../package-dir/.../catalog.xml
3.3. Registering/Deregistering Resources
3.3.1. Using dh_installxmlcatalogs with XML Catalogs
3.3.2. Using dh_installcatalogs with SGML Catalogs

This chapter describes the Debian hierarchical implementation of the OASIS XML Catalogs specification.

3.1. About XML Catalogs

A catalog system provides a means to locate entities that are referenced in an XML document. A typical entity reference would be the external file defining the Document Type Definition (DTD) for the document in question. The DTD provides the grammar for the elements (tags) used in the document.

The reference to the DTD is part of the document prolog. A typical prolog for a DocBook XML document might look like

<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

Where the DTD is referenced by the optional Formal Public Identifier (FPI) defined by the PUBLIC keyword:

PUBLIC  "-//OASIS//DTD DocBook XML V4.2//EN"

and by the required System Identifier:

http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd

Another possible prolog for the same document might omit the FPI and use only the system identifier:

<?xml version="1.0"?>
<!DOCTYPE book SYSTEM 
          "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

The catalog system provides a means of locating the DTD by mapping these PUBLIC and SYSTEM identifiers to the external file which defines the DTD. A catalog-aware processing tool will then search the XML catalogs until it finds the statement that resolves one of the identifiers to the DTD file.

The processing tool will systematically search the catalog system until it locates the entity. By default it will first search the root catalog /etc/xml/catalog, which will then direct the lookup to the appropriate package catalog, /etc/xml/docbook-xml.xml. The package catalog will then direct the lookup to the appropriate local catalog, which in this case would be /usr/share/xml/docbook/schema/dtd/4.2/catalog.xml. This local catalog will provide the information needed to locate the external file defining the DTD, /usr/share/xml/docbook/schema/dtd/4.2/docbookx.dtd, in this example.

Implementation Goals

  • Optimize the Lookups: the only fully parsed catalog entry files should be the Local Catalogs associated with a given resource.

  • Provide Packaging Registration Tools: Developer tools should be provided that simplify the registration and deregistration of XML resources in the catalog system. These tools should therefore simplify the packaging of XML resources.