It is a truth universally acknowledged that “DTDs don’t support namespaces”. Or to be a little more pedantic, that DTDs don’t support namespaces in their full generality. However, one might as well say that XML 1.0 does not support namespaces. Given that the specification of Namespaces in XML augments XML 1.0, it seems more reasonable to ask why don’t namespaces support DTDs?
The specification for namespaces in XML makes no attempt at supporting DTDs, merely including a paragraph describing the lack of support:
Note that DTD-based validation is not namespace-aware in the following sense: a DTD constrains the elements and attributes that may appear in a document by their uninterpreted names, not by (namespace name, local name) pairs. To validate a document that uses namespaces against a DTD, the same prefixes must be used in the DTD as in the instance.
Lack of support for DTDs seems like a serious omission in the specification of namespaces, and one that could have been easily remedied. For example, a processing instruction could have been introduced to define namespace prefixes within DTDs:
<?xmlns html href="http://www.w3.org/1999/xhtml"?> <!ELEMENT html:title (#PCDATA)>
This would allow a namespace aware XML parser that performs validation to match elements based on their namespace name, not just their prefix, and allows the prefix used in the document to differ from the prefix used in the DTD. There would also need to be rules describing how validation applies to xmlns attributes in the document; I think that the easiest solution here is just to ignore them, as most other schema languages do.
The xmlns processing instruction would fit in with the goals of namespaces in XML by creating a strict subset of the existing XML 1.0 syntax that is still backwards compatible with older parsers. More importantly, it would remove a major limitation that has affected many XML users. Why wasn’t something like this specified in the beginning?


A couple of related postings with similar suggestions.
http://lists.xml.org/archives/xml-dev/200206/msg00449.html
http://www.mulberrytech.com/Extreme/Proceedings/html/2003/Gessa01/EML2003Gessa01.html
I suppose it may still make it into ISO/IEC 19757-9 one day but
http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=41009&scopelist=ALL
isn't exactly encouraging! Meanwhile there's Relax NG.
It's interesting that both of those proposals extend the DTD syntax instead of subsetting it, leading to incompatibilities with existing parsers. Perhaps this is because they are trying to add support for datatyping as well, which is more difficult (impossible?) to support transparently.
Frankly, I think that people who need datatyping are more than willing to use newer schema languages (XSD, RELAX NG), and that namespace support for DTDs from the beginning would have been much more beneficial -- past tense unfortunately, because as with most XML permathreads that ship has long sailed.