<<< 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.

RELAX is a new approach to providing that reference document. A RELAX document gives all the information that a DTD does, and, since it's an XML document, it's more readable than a DTD. Additionally, it 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.

RELAX is a very flexible markup language, and has many capabilities (and shortcuts!) that this brief article has not covered. For further information, you should see the How to RELAX tutorial.

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