|
XML Schema types and equivalence classes
reconstructing
DTD best practice
|
 |
Eve L. Maler and Jeanne El Andaloussi in their book "Developing SGML
DTDs" describe a flexible and powerful methodology for DTD design and development
which is widely used in a range of application environments, and is generally
recognised as constituting 'best practice' in this area. It makes heavy use
of parameter entities to define and exploit a class hierarchy of element types.
XML Schema is a W3C-sponsered effort to define an alternative to DTDs
for defining the structure of XML documents, using XML instance syntax. Not
surprisingly therefore, it defines element types for declaring elements and
attributes.
Despite an official requirement to at least reproduce the functionality
of DTDs, XML Schema none-the-less contains no text macro facility, which might
be expected to reproduce the functionality of parameter entities. How then
is 'best practice' to be carried forward from DTDs to XML Schemas?
The answer lies in two powerful mechanisms which XML Schema introduces:
user-defined types (distinct from element types, but crucially involved in
their declaration) and element equivalence classes. This paper describes in
detail XML Schema's concepts of complex type, type definition by derivation
and element equivalence class, shows how they relate to one another, and illustrates
their use to define type hierarchies and element class hierarchies without
recourse to parameter entities.