OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what did DTDs do to deserve such a bad rep[WD-xmlquery-use-cases-20010608 : 1.7.2 Document Type Definition (DTD)]



At 15:52 25-06-2001, james anderson wrote:
>As an aside, DTDs are, in themselves, compatible with namespaces.
>
>XML processors may well, as an unfortunate rule, ignore the namespace
>information which is encoded in a dtd which leads them to interpret
>homographs and synonyms naively and to misinterpret names.
>This does not mean that a DTD cannot express the "equality of nodes ...".

The key phrase was "full compatible".  A DTD cannot assert that a content 
model must have namespace X + local name Y, it asserts prefix Z + local name Y.

Example:

<!ELEMENT ex:foo (ex:bar+)>
<!ATTLIST ex:foo
           xmlns:ex CDATA #FIXED "http://www.example.com/">

First, note that there's no way to declare namespaces in scope for this 
declaration; the ATTLIST doesn't have any effect on the DTD, it only adds 
the declaration as an attribute *to particular instances*.  But ignoring 
that for the moment and focusing on the content model, I can do this:

<ex:foo xmlns:ex="http://www.example.com/">
   <ex:bar/>
   <ex:bar/>
</ex:foo>

but I can't do this:

<ex:foo xmlns:ex="http://www.example.com/">
   <ex:bar/>
   <e2:bar xmlns:e2="http://www.example.com"/>
</ex:foo>

Those two document snippets have identical infosets and XPath data models, 
modulo a namespace declaration for e2.  But there is no way to create a DTD 
that will accept all documents like this.  (Yes, you can use parameter 
entities to vary the prefix or use the default namespace from document to 
document, but you can not allow for variation within a single document.)

-Chris
-- 
Christopher R. Maden, XML Consultant
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA