MENU
Schema Languages
A grammar-based schema language, such as DTD or Relax NG, declares the grammar for an XML document. It defines the permissible structures, contents, and orders of the elements, attributes, and entities.A rule-based schema language, such as Schematron, specifies the relationships that must hold for the values of elements and attributes.
Very expressive, XSD is both grammar-based and rule-based.

An XML document that conforms to the schema defined in a schema language is said to be valid.
An XML document can be validated online using tools such as: Offline validation tools include:
- Jing (Relax NG and Relax NG Compact): http://www.thaiopensource.com/relaxng/jing.html
- XML Validator Buddy (Schematron): http://www.xml-buddy.com/download.htm
This chapter covers the following schema languages:
- DTD - Document Type Definition, the original XML schema language, declared internally or in an external file. It is the only schema language that allows entities to be defined.
- XSD - XML Schema Definition (W3C XML Schema), the most expressive and most widely tooled schema language. Current is XSD 1.1, a W3C Recommendation.
- Relax NG - an XML-based schema language that is somewhat simpler to learn than XSD.
- Relax NG Compact - a compact, non-XML syntax equivalent to Relax NG.
- Schematron - a rule-based schema language built on XPath, standardized by ISO rather than the W3C.