Chapter 5. XML Schemas

In the last chapter, you learned that you can use Document Type Definitions (DTDs) to validate your XML documents. This avoids the need to write application-specific code to check whether your documents are valid. You also saw some of the limitations of DTDs. Since the inception of XML, several new formats have been developed that enable you to define the content of your vocabulary.

In 1999, the W3C began to develop XML Schemas in response to the growing need for a more advanced format for describing XML documents. Work had already begun previously on several efforts that were intended to better model the types of document being created by XML developers. The W3C's effort took the best of these early technologies and added more features. During development, several members of the W3C designed simpler schema languages with fewer features outside of the W3C. Perhaps the most important effort is RELAX NG, covered in depth in Chapter 6.

Today, XML Schemas are a mature technology used in a variety of XML applications. Apart from their use in validation, XML Schemas are used in XQuery, covered in Chapter 9. XML Schemas can also be used in conjunction with web services and SOAP, as shown in Chapters 14 and 15, respectively.

Note

A schema is any type of model document that defines the structure of something, such as database structures or documents. In this case, the something is an XML document. In fact, DTDs are a type of schema. Throughout this book, we have been using ...

Get Beginning XML, 4th Edition 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.