Chapter 4. Installing the TEI DTDs

Table of Contents

Finding and downloading the DTDs
Installing
User only install
System wide install
Your system catalog files
Setting up your catalogs
The system wide XML catalogs

Abstract

A step through installing the Text Encoding Initiative DTDs

Here we assume you have a working knowledge of a Linux or similar, file system and command line. No advanced commands or tools are used, examples of all commands are given.

Finding and downloading the DTDs

The recommended way of finding the TEI DTD set is to use your distributions package search tools.

In Debian you may say:account@host:~$ apt-cache search TEI

Alternatively you may find them using "RPMfind" or similar package search engines.

If your distribution has prepackaged the TEI2 P4 DTDs, please use them. Ideally they will also automate your SGML and XML catalog set up as well. Otherwise you will need to hand install them. It's not that complex, perhaps a little tedious, follow the steps below.

The TEI Consortium keeps a downloadable zipped set at http://sourceforge.net/project/showfiles.php?group_id=106328&package_id=114572.

Installing

If you used a "binary package", you might be able to skip this section. Your TEI DTDs should be installed somewhere under /usr/share. If you are installing from the zip file, you have a little more work to do.

First you have to make a decision. Do you want to install so other users may use them?

If not, you can install them anywhere you have write permissions. If so, install them under /usr/local/share. You will need administrator level permissions to do so. Please see the section called “System wide install”. You could pass them to your local administrator and ask her to set everything up for you :) OK in real life it goes like this...

User only install

Download the zip file from The TEI Consortium at: http://sourceforge.net/project/showfiles.php?group_id=106328&package_id=114572.

account@host:~$ cd /home/account; mkdir TEI

[Caution]Caution

You must create a new directory, since the zip archive unpacks without a directory structure, cluttering your current directory!

account@host:~$ cd TEI

account@host:~$ unzip ../tei-0.3.1.zip

You should get a directory full of files that looks much like this:

catalog.local   teiclas2.ent  teigen2.dtd   teind2.ent    teite2n.dtd
catalog.tei     teicore2.dtd  teigis2.ent   teinet2.dtd   teiterm2.dtd
catalog.xml     teicorp2.dtd  teihdr2.dtd   teipl2.dtd    teiterm2.ent
dummy.dtd       teidict2.dtd  teikey2.ent   teipros2.dtd  teitran2.dtd
index.html      teidict2.ent  teilink2.dtd  teisgml.dec   teitran2.ent
index.xml       teidram2.dtd  teilink2.ent  teishd2.dtd   teitsd2.dtd
tei2.dtd        teidram2.ent  teilite.dec   teispok2.dtd  teivers2.dtd
teiana2.dtd     teifig2.dtd   teilitex.dec  teispok2.ent  teivers2.ent
teiana2.ent     teifig2.ent   teilitex.dtd  teistr2.dtd   teiwsd2.dtd
teiback2.dtd    teifron2.dtd  teilitex.ent  teitc2.dtd    teixlite.dec
teicatalog.xml  teifs2.dtd    teimix2.dtd   teitc2.ent
teicert2.dtd    teifsd2.dtd   teind2.dtd    teite2f.dtd
	

You have now installed them. Move the original tei-0.3.1.zip away for archiving and you are done. The file index.html has some reading for later...

[Note]DOCTYPE system identifier

You will have to use a /full/path/name/to/your/DTD in the DOCTYPE declaration if you need to validate the file as SGML.

For correct XML validation you will have to use a file URI like file:///path/to/your/dtd in your DOCTYPE system identifier string. See the section called “The DOCTYPE Declaration”.

System wide install

This is no more difficult than undertaking a user only install. The difficult part is knowing where to install them.

After some trial and error, referring to the Linux File Hierarchy Standard, and various Debian docs I decided to install these DTDs as an XML based technology.

That is, we need to install to /usr/local/share/xml/tei2/p4/schema/. Install anywhere you like of course, the rest of this document will assume you installed as above though. I also assume you may want to put other versions of the TEI DTDs on your system as well.

Example 4.1. Administrator install

mkdir -p /usr/local/share/xml/tei2/p4/schema/dtd/

cp tei-0.3.1.zip /usr/local/share/xml/tei2/p4/schema/dtd/

cd /usr/local/share/xml/tei2/p4/schema/dtd/

unzip tei-0.3.1.zip

rm tei-0.3.1.zip


OK. Now everybody may access the TEI DTDs. Especially if the catalogs are set up as well... You may also symlink to the appropriate place under /usr/local/share/sgml/ or elsewhere. If you do so, I strongly suggest you mirror your package management's file system structure. The catalog system described below assumes you haven't. Only do it if you need to.

Your system catalog files

To automate detection of your newly installed DTDs, you need to set up your catalog systems to reflect the state of your XML and SGML trees. Please keep originals as copies, at least until you have tested it all few times (Check that you don't break DocBook for example). Here we are going to do this all by hand. There are tools to automate this. However they seem to be distribution dependent and on Debian at least are in a state of change (Feb 2004).

The SGML catalog system uses layers of catalog files to map to your local DTD and other lower level SGML files. The highest level file is called the "Super Catalog" and lives under /etc/sgml. The next level down is called the "Central Catalog" and it also normally lives under /etc/sgml. The final catalog may contain the particular set of SGML "engine room" files way down deep in the file system. This is often called the "Application Catalog" or the "Local Catalog".

What all these catalogs do is to map the canonical PUBLIC identifiers (the planet wide ones) to your local system. If it helps, just consider them as a series of includes. The XML system is similar to this, though a little more efficient at run time. When you ask to use a DTD, the catalog system checks identifiers in the prolog of the document and finds the correct match for you. One of the clever things about this is that the matching file need not be on your computer, but here we will assume it is.

Setting up your catalogs

[Note]Note

This section assumes you have administrator (or similar) permissions.

If you have the update-catalogs command or similar please use them.

First we need to edit the TEI2 application level catalog: /usr/local/share/xml/tei2/p4/schema/dtd/catalog.tei. Open the file in a good text editor, read the instructions in the commented out head section (SGML Comments are two dashes like so: -- ). Do a replace as per the instructions. The following example may be appropriate for you to cut and paste... Check the install path is the same as yours.

Example 4.2. New SGML catalog.tei

--  
/usr/local/share/xml/tei2/p4/schema/dtd/catalog.tei 
    This TEI catalog file was auto-generated by makeCatalogs.xsl for use with 
    TEI P4X DTD fragments.
	edited for the Freedict project Feb 2004.
	added PUBLIC "-//TEI P4//DTD Main Document Type//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/tei2.dtd"

    	Before use YOU MUST REPLACE THE STRING

	 /usr/local/share/xml/tei2/p4/schema/dtd/ 

	with the path to your local copies of the TEI DTD fragments.
	canonically located at
       http://www.tei-c.org/Guidelines/DTD/

--

PUBLIC  "-//TEI P4//DTD Main Document Type//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/tei2.dtd"

PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Simple Analysis//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiana2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Simple Analysis//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiana2.ent"
PUBLIC "-//TEI P4//ELEMENTS Back Matter//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiback2.dtd"
PUBLIC "-//TEI P4//ENTITIES TEI ElementClasses//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiclas2.ent"
PUBLIC "-//TEI P4//ELEMENTS Core Elements//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teicore2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Front Matter//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teifron2.dtd"
PUBLIC "-//TEI P4//ELEMENTS TEI Header//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teihdr2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Default Text Structure//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teistr2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Certainty and Responsibility//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teicert2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Language Corpora//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teicorp2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Print Dictionaries//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teidict2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Print Dictionaries//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teidict2.ent"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Drama 2001-12//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teidram2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Drama//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teidram2.ent"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Tables, Formulae, and Graphics//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teifig2.dtd"
PUBLIC "-//TEI P4//ENTITIES Formulae Notations and Contents//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teifig2.ent"
PUBLIC "-//TEI P4//DTD Auxiliary Document Type:  Feature System Declaration//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teifsd2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Feature Structure Annotation//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teifs2.dtd"
PUBLIC "-//TEI P4//ELEMENTS General Base Element Set//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teigen2.dtd"
PUBLIC "-//TEI P4//DTD Main Document Type//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/tei2.dtd"
PUBLIC "-//TEI P4//ENTITIES Generic Identifiers//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teigis2.ent"
PUBLIC "-//TEI P4//ENTITIES TEI Keywords//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teikey2.ent"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Linking, Segmentation, and Alignment//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teilink2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Linking, Segmentation, and Alignment//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teilink2.ent"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Mixed Text Types//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teimix2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Names and Dates//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teind2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Names and Dates//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teind2.ent"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Graphs, Networks, and Trees//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teinet2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Prose//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teipros2.dtd"
PUBLIC "-//TEI P4//DTD Auxiliary Document Type: Independent TEI Header//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teishd2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Transcriptions of Speech//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teispok2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Transcriptions of Speech//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teispok2.ent"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Text-Critical Apparatus//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teitc2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Critical Apparatus//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teitc2.ent"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Terminological Data//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiterm2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes
for Terminological Data//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiterm2.ent"
PUBLIC "-//TEI P4//ELEMENTS Terminological Databases (Flat)//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teite2f.dtd"
PUBLIC "-//TEI P4//ELEMENTS Terminological Databases (Nested)//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teite2n.dtd"
PUBLIC "-//TEI P4//ELEMENTS Additional Element Set for Transcription of Primary Sources//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teitran2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Transcription of Primary Sources//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teitran2.ent"
PUBLIC "-//TEI P4//DTD Auxiliary Document Type: Tag Set Documentation//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teitsd2.dtd"
PUBLIC "-//TEI P4//ELEMENTS Base Element Set for Verse//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teivers2.dtd"
PUBLIC "-//TEI P4//ENTITIES Element Classes for Verse//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teivers2.ent"
PUBLIC "-//TEI P4//DTD Auxiliary Document Type: Writing System Declaration//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teiwsd2.dtd"
PUBLIC "-//TEI P4//DTD Concurrent Document Type: Pages and Lines//EN" "/usr/local/share/xml/tei2/p4/schema/dtd/teipl2.dtd"
	  

Next we need to write a central Catalog for the TEI DTD set. This file lives at /etc/sgml/tei2.cat. You can cut and paste this one.

Example 4.3. Sample SGML central catalog file

--
##====================================================
##              /etc/sgml/tei2.cat 
## Centralised SGML catalog file for the tei2-p4 DTDs
##====================================================
--

CATALOG /usr/local/share/xml/tei2/p4/schema/dtd/catalog.tei
	  

Finally we need to add the central Catalog file to the top level system catalog.

[Warning]Warning

Please don't just cut and paste this file! It probably will not match your local needs for all sorts of reasons. Just add the TEI section. CATALOG /etc/sgml/tei2.cat.

Example 4.4. Addition to SGML super catalog

Super catalogs _may_ be Debian specific in which case you _may_ be able to leave it out.

-- 
## ======================================================================
## /etc/sgml/catalog : SGML super catalog
## ======================================================================
## ======================================================================
--
CATALOG /etc/sgml/sgml-data.cat
CATALOG /etc/sgml/docbook-xml.cat
CATALOG /etc/sgml/docbook.cat
CATALOG /etc/sgml/docbook-dsssl.cat
CATALOG /etc/sgml/w3c-dtd-xhtml.cat
CATALOG /etc/sgml/gnome-doc-tools.cat
CATALOG /usr/lib/sgml/transitional.cat
CATALOG /etc/sgml/sgml2x.cat
CATALOG /etc/sgml/docbook-html-forms.cat
CATALOG /etc/sgml/docbook-simple.cat
CATALOG /etc/sgml/openjade.cat
CATALOG /etc/sgml/metacity.cat
CATALOG /etc/sgml/festival.cat
##=======================================================================
## TEI section follows here
##========================================================================
CATALOG /etc/sgml/tei2.cat
	  

Now you may use a large variety of approaches in your document type declaration.

Throughout this HOWTO we generally only use one. Please see the section called “The DOCTYPE Declaration”

The system wide XML catalogs

The XML system uses a similar approach to SGML catalogs. XML catalogs like all XML technologies are validated and so are marked up and identified like any other XML file. Once again there are a couple of automatic tools about, by all means use them. The following files are for reference.

Example 4.5. XML application catalog

In our example this goes in /usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml. It must replace the existing file of the same name.

	   <?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"/>
<delegatePublic publicIdStartString="-//TEI P4//DTD Main Document Type//EN" catalog="file:///usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml"/>
<delegateSystem systemIdStartString="http://www.tei-c.org/P4X/DTD/tei2.dtd" catalog="file:///usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml" />
<delegateSystem systemIdStartString="http://www.tei-c.org/Guidelines/DTD/tei2.dtd" catalog="file:///usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml" />
</catalog>
	

The delegate sections tell XML compliant applications where to look for the TEI2 DTDs. The strings go into the document prolog DOCTYPE declaration.

Example 4.6. The XML super catalog

Use your system tools if you trust them. Here is an example catalog off a Debian box.

Please don't just copy and paste this. You only need the two last entries, they map TEI prologs for us (Make sure you put them inside the closing catalog tag ;>).

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
  "file:///usr/share/xml/schema/xml-core/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<delegatePublic publicIdStartString="-//OASIS//DTD XML Catalogs V1.0//EN" catalog="file:///etc/xml/xml-core.xml"/>
<delegateSystem systemIdStartString="http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd" catalog="file:///etc/xml/xml-core.xml"/>

<delegatePublic publicIdStartString="-//TEI P4//DTD Main Document Type//EN" catalog="file:///usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml"/>
<delegateSystem systemIdStartString="http://www.tei-c.org/P4X/DTD/tei2.dtd" catalog="file:///usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml" />
<delegateSystem systemIdStartString="http://www.tei-c.org/Guidelines/DTD/tei2.dtd" catalog="file:///usr/local/share/xml/tei2/p4/schema/dtd/catalog.xml" />
</catalog>
	  

OK, you now really installed everything and are ready to do much more than write dictionaries. In the next sections we cover some TEI introductory history, XML basics and describe how and what all this means... to a point.

[Note]XML catalog for TEI package in SuSE 9.0 is broken

The tei_4 package in SuSE Linux 9.0 has a broken XML catalog. You have to repair it manually. This might apply to earlier versions as well.