Better Validation with Schemas

The DTD mechanism that was included in the XML 1.0 recommendation allows fairly sophisticated document structures to be declared. But when programmers started to apply XML to rigorous data transfer applications (such as importing and exporting data from a relational database), the limitations of DTDs became quite obvious. DTDs cannot restrict what types of character data can be stored in an element, allowing anomalies such as this:

<phone-number>smeans@strategicxml.com</phone-number>

The XML Schema recommendation (which was finally approved on May 2, 2001) is intended to address the shortcomings of the XML DTD and provide capabilities for very strict document content validation. The remainder of this chapter attempts ...

Get Strategic XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.