Why bother using DTDs?

XML has namespaces. Namespaces allow combining several XML "languages" 
in one document. DTDs don't allow any such dynamic combination.

Where is the point in bothering with DTD validity any longer, when there 
is already XML Schema?
In theory and usually in practice every namespace refers to (but not 
neccessarily directly points to) an XML Schema defining what is valid in 
the namespace and what is not. This is a more dynamic mechanism than 
using DTDs.

There is already a way to tell a browser what schema a namespace 
*should* be associated with. Certain pieces of software (eg. jEdit with 
the XML plugin) already performa a schema validity check using the 
schemaLocation attribute.
That is a nice way, but it is obviously not the best because it clutters 
up the document with a long list of all namespaces used and the schemas 
they should be associated with.

A better solution would be a processing instruction. For DTDs there are 
catalogs like the OASIS catalog provided via a <?oasis-xml-catalog 
catalog="..."?> PI. Why not introduce a standardized external schema 
catalog? A catalog could look as simple as that:

<?xml version="1.0"?>
<?xml-schema-catalog href=""?>
<catalog xmlns="http://www.w3.org/2004/xmlns-catalog">
<group id="W3C" xml:base="http://www.w3.org/">
<schema namespace="http://www.w3.org/2004/xmlns-catalog" 
uri="2004/xmlns-catalog.xsd"/>
<schema namespace="http://www.w3.org/1999/xhtml" uri="1999/xhtml.xsd"/>
</group>
</catalog>

(Note: the structure was taken from OASIS' DTD catalogs)

The only problem that would remain is the declaration of entities, but I 
don't see why Schema can't handle that anyway.

I also don't see why XHTML 1.0 (Strict|Transitional|Frameset) and XHTML 
1.1 share the same namespace, although they would hardly share the same 
schema.

-Alan

Received on Monday, 5 April 2004 09:00:57 UTC