Re: XML validity and namespaces

Rich Salz wrote:
> DTD's are ignorant of namespaces.  This means that you cannot write a
> normative DTD for a namespace (as you might do with XML Schema). The
> best you can hope to do is write something for expository purposes,
> using particular namespace prefixes as an example.  Each instance of
> a document would then have to rewrite the DTD to use the namespace
> prefixes that are used in the document.
> 

Actually you can do quite a bit better than that. It's possible to use 
parameter entity references such that the same DTD can be used for 
multiple prefixes and the default namespace. The most any instance 
document needs to do is override two parameter entity declarations. This 
is discussed and demonstrated in XML in a Nutshell and the XML 1.1 
Bible, and probably other sources. The technique is well-known and used 
by most W3C working groups that produce DTDs. It may have been invented 
by the MathML working group. In any case, that was the first place I saw 
it.

-- 
Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

Received on Sunday, 3 April 2005 20:57:00 UTC