Doctype

To now have an arbitrarily sequence of elements and attributes, a doctype line as the following can be added, to tell that the xml file follows some rules.

After the word Doctype the name of the root element of the document follows, this is in the above document html. There are two ways to point to the dtd.

Using the public identifier https://en.wikipedia.org/wiki/Formal_Public_Identifier that follows after the word PUBLIC and an optional link to an external file where the dtd can be found. If a program likes to check if the xml data is valid (good programs should do that) then it needs to download the external file. This can obviously take some time and overload some servers holding the dtd. Since everybody can setup Public Identifier and they need to be analyzed using xml catalog files, they might not be unique but obviously should.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Using the system identifier SYSTEM, that can be used to point directly to the dtd.

    <!DOCTYPE EMail SYSTEM "<url or file name>">

To improve this situation xml catalog files are used /etc/xml/catalog. They simply hold how external uri points to a local copy of the desired file (this works also for directories):

    <system systemId= "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" uri="file:///etc/xml/tidy/xhtml1-transitional.dtd"/>

Or by using the public identifier

    <public publicId='-//OASIS//DTD DocBook XML V4.2//EN'        uri='file:///path/to/docbook/docbook-V4.2/docbookx.dtd'/>

The external files can be downloaded as:

wget http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd


Linurs Servernest startpage