XML validity and namespaces

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.

If the document uses elements from multiple namespaces, however,
and even if you can collect all the DTD's and rewrite them to map
the prefixes used in a particular document instance, you can't do
this for every case.  Viz:

    <tns:Foo xmlns:tns="http://example.com/1999">
        <tns:Foo xmlns:tns="http://example.com/2002">
            content
        </tns:Foo>
    </tns:Foo>

It seems to me, then, that DTDs are not useful, and maybe not
even possible, for XML standards or documents that use namespaces.
The problem with this is that XML validity requires a DTD (see [1]).
XML Schema, in a round-about way, enforces ID attribute uniqueness,
but only for that part of the document that is being validated;
if the schema does not start at the document root, there is no
guarantee.  The desire for composability means comparatively few
schemas (at least horizontal ones, such as developed by standards
organizations) will cover the entire document.  XML Schema may
also enforce other aspects of XML validity; I am not familiar enough
with the specs to say.

XML validity is important, and perhaps should be separated from DTD's.

        /r$

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#dt-valid

-- 
Rich Salz                  Chief Security Architect
DataPower Technology       http://www.datapower.com
XS40 XML Security Gateway  http://www.datapower.com/products/xs40.html

Received on Sunday, 3 April 2005 18:25:04 UTC