In the XHTML sample we discussed in tutorial 5, data types were not that important—all the document content was of the string data type. Often, however, you will have documents that contain several different data types, and you will want to be able to validate these data types. Unfortunately, DTDs are not designed for validating data types or checking ranges of values. DTDs also do not understand namespaces.
To solve these problems, schemas were invented. Unlike DTDs, which have their own peculiar syntax, XML schemas are written in XML. In addition to providing the information that DTDs offer, schemas allow you to specify data types, use namespaces, and define ranges of values for attributes and elements. In this tutorial, you'll learn about XML schemas and how to use them in your XML documents. We'll look at the XML schema data types and their categories and then explore how to create simple and complex data types. Finally, we'll examine namespaces used in XML schemas.