DTD and XML Schema
Home ] Up ] Why XML? ] Domain-Specific MLs ] XML for XML ] XML Parsing ] XML Documents ] XML Namespaces ] [ DTD and XML Schema ] Using Java with XML ]

 

DTDs
XML Schema

 

An XML Parser will indicate whether an XML document is well-formed, which simply means that the document conforms to the syntax rules of XML.

However, a well-formed XML document is not necessarily valid, in the context of a particular application.  It is desirable to provide some mechanism by which an application can determine the validity of an XML document.  This essentially means defining the rules for a given document's contents and structure.

There are two standard mechanisms for formally defining the structure and content of an XML document:

  • Document Type Definition (DTD)

    This was the first to be developed, and is a legacy of XML's Standard Generalized Markup Language (SGML) roots.

    Originally developed for documents whose purpose was to exchange simple data.  HTML (http://www.w3.org/TR/html4/sgml/dtd.html) and XHTML (http://www.w3.org/TR/html/#dtds) each have DTDs

  • XML Schema

    Developed as a result of the weaknesses of the DTD approach.

    Provides finer granularity of control for documents that can be used to exchange more complex data.

    There is an XML Schema definition for XHTML at http://www.w3.org/TR/xhtml1-schema/ .

 
The page was last updated February 19, 2008