A DTD is a set of declarations and comments that
allow you to state important invariants about a document, removing
constants to a header. This helps manageability (e.g., entity
declarations and default attribute values), quality assurrance (e.g., element
validity against a content model) and de-couples the creators of a document from
the users of it to a certain extent.
Unlike DTDs, W3C XML Schemas uses XML element
syntax, are namespace-aware and provide the kinds of datatyping that people
expect. They will be most helpful for automatically generating
optimized interfaces which accept or generate
documents, for example SQL and Java systems. W3C XML Schemas content
models are mcuh more sophisticated than DTDs; they have many features
to support extensibility, such as wildcarding and substitution
groups. W3C XML Schemas schemas will probably not be downloaded over the
WWW at the same time as the document; they will tend to be built-in.
DTDs operate on the raw information of the
document right after it is parsed--declaration recognition is built into all XML proessors (though only validating
parsers make use of all the information in the declarations); W3C XML Schemas
operate on the "information set" of the document as a separate stage (though how
much the information set will be augmented by schema-processing a
document is not being defined yet.) A simple DTD may correspond to a
more complex W3C XML Schema schema, and vice versa; a complicated DTD (with lots
of parameter entities and INCLUDE./IGNORE sections) may be simpler in W3C XML
Schemas. A DTD can be transformed into a W3C XML Schemas schema and vice
vera, but with some loss of information.
Rick Jelliffe
Hello all,
I am fairly new to XML and trying to
understand the difference between DTDs and schemas. Is one a subset of the
other? What are the key objectives to each? Can someone
briefly
|