Tuesday, March 27, 2007


Schematron is an XML schema language that sounds better than what we have been using for our data. It allows for data validation. O'Reilly has a paid downloadable PDF on Schematron.
Schematron is a rule-based XML schema language, offering flexibility and power that W3C XML schema, RELAX NG, and DTDs simply can't match.

You need Schematron and can't settle for other languages if you have to check rules that go beyond checking the document structures (i.e., checking that an element bar is included in element foo) and their datatypes. Schematron is the right tool for checking conditions such as "startDate is earlier than or equal to endDate."

Schematron is also the right tool to use if you have to raise user-friendly error messages rather than depend on error messages that are generated by a schema processor and that are often obscure. Schematron builds on XPath. You will need to understand XPath to to get the most from Schematron.

1 comment:

Jonathan said...

Schematron is often most effective in conjunction with another schema language. Since it's rule-based, it has a lot of flexibility for validating data conditions, but it's much easier to do simple validation of hierarchical constructs in a grammar-based schema language. DocBook 5, for example, uses a Relax NG schema annotated with Schematron assertions to specify additional constraints.