Axel Dahmen wrote:
I see, from all responses I now see that dealing with DTD on XML seems to be a waste of time then.
There are folks who will argue about this, but that's essentially the
conclusion I've reached. DTDs were inherited from SGML, back when XML
was new and XML was mostly being processed through tools also inherited
from SGML. While it *might* have been possible to extend DTDs to deal
with namespaces, it would have been somewhat ugly and the namespace
committee fairly explicitly decided that it was better to leave them
behind.
If we had it all to do over again, it might have been better to have
defined the XML Infoset first -- including namespaces and some of the
other features -- and then derived schemas and the XML syntax and the
other tools and APIs from that basis. But doing it in this order, while
it has resulted in some confusion, allowed XML to get out into the real
world and establish itself a lot faster, so I can't really argue that it
was the wrong decision.
So is it safe then to assume that an XML document having no DTD but a
reference to XML Schema is still declared to be valid (provided the
XML data is valid)?
Due to the order in which things were defined, there are actually two
separate definitions of validity -- validity against the DTD (if any)
and validity against the schema (if any). Schema wasn't allowed to alter
the basic XML specification, so it wasn't allowed to change or enhance
the old meaning of validity; it had to add a secondary one. (There are
also some subtleties in exactly where additional information from the
schema winds up in the XML Infoset that also come from this decision
that schemas add information rather than changing information, which you
may be able to ignore for a while.)
So: There is Validity, and there is Schema Validity. Normally you're
only worried about one, and tools may mask this distinction by reporting
invalid if either stage fails.
I know, more detail than you wanted. And if you're lucky, more
information than you'll need for a while. But you asked.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry