Summary

<<< We've seen how there are two levels of determining whether an XML document is “good” or not. The first level is well-formedness, checking to see if tags are closed and nested properly, etc. This checking can be done with nothing more than the document at hand.

If, however, you wish to know if the tags and attributes are valid for the particular markup language that you're working with, you need to refer to another document. This has always been the DTD (Document Type Definition), which tells you which tags are available and the contexts in which they may appear.

XML Schema is a new approach to providing that reference document. A schema gives all the information that a DTD does, and, since it's an XML document, it's more readable than a DTD. Additionally, a schema lets you validate that content is appropriate for a given tag. You can specify that a tag must enclose numeric data within a certain range, or belong to one of a specific list of values.

XML Schema is a very flexible markup language, and has many capabilities that this short article has not covered. For further information, you should see the XML Schema primer.

  1. Validating XML with XML Schema
  2. Validity and the DTD
  3. Validity and the Schema
  4. Specifying Elements
  5. Making Validation More Specific
  6. Making New Types
  7. Enumerations
  8. The Big Picture
  9. Summary