DTD VS.XML schemas

 

DTD

XML schemas

syntax EBNF XML
size compact verbose
have been around ~30 years new
can be parsed no yes
namespaces are not supported supported
data types document-oriented data types data-oriented data types
data types 10 37
occurrences 0, 1 or more.

xx to yy can be specified, but unelegantly and only for small values
any number of occurrences can be specified precisely (1 to 3, for example)
enumeration for attributes only for attributes and element content
constraints for attribute values only;

limited set of constraints (fixed value, choices...)
rich set of constrains (length, pattern, enumeration, precision, scale...)
defaults for attributes yes yes
attribute grouping no yes
inheritance no yes
extensibility no new data types can be derived
modularity one DTD per document (can be divided into internal and external part) as many schemas per document, as needed
dynamics read-only can be modified at run-time

Mostly from:
Beginning XML. David Hunter, Curt Cagle, Dave Gibbons, Nikola Ozu, Jon Pinnock, Paul Spencer.
Wrox Press Ltd.