XML technologies / DocBook / Customizing DocBook / DocBook 4 structure / Validating with a DocBook 4 customization file

(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)

The previous section explained the structure of a DocBook 4 customization file. To use it for your documents, proceed as follows:

  1. First add a DOCTYPE declaration to every XML file belonging to your document. In Writing a customization file for DocBook 4 you learned that there are two options:

    • Customization file in the same directory as the XML files
      Use the following syntax in your XML file if you do not exchange documents with others:

<!DOCTYPE book SYSTEM "mydb.dtd">

    • Referencing the customization file independently of the platform
      Use public and system identifiers if you exchange documents or process them on different operating systems. Name your identifiers (see Naming DocBook 4 customizations). For example:

<!DOCTYPE book PUBLIC "-//Tux//DTD DocBook V4.5-Subset//EN" "http://www.example.com/docbook/mydb.dtd">

Also use an XML catalog and add the following lines:

<public publicId="-//Tux//DTD DocBook V4.5-Subset//EN" uri="PATH"/> 
<system systemId="http://www.example.com/docbook/mydb.dtd" uri="PATH"/>

Replace PATH with the path to your customization file.

  1. If you use an XML catalog, set the environment variable XML_CATALOG_FILES in your shell and replace KATALOG with the path and filename of your XML catalog:

    • For Linux:
      export XML_CATALOG_FILES=KATALOG

    • For Windows:
      set %XML_CATALOG_FILES%=KATALOG

  2. Validate your XML document. Replace XMLDATEI with your XML document’s filename:

    xmllint --valid --noout XMLDATEI

  

back to top