concept Schematron in category nosql

appears as: Schematron
Making Sense of NoSQL

This is an excerpt from Manning's book Making Sense of NoSQL.

5.4.2. Using Schematron to check document rules

Schematron is considered the “feather duster” of document validation. Schematron’s focus is the hard-to-reach areas of data type checking that can’t be done in a single pass with XML Schema. Let’s say you want to check that the sum of all the line items in a sales order is equal to the sales total; you could do this with a Schematron rule. Schematron rules are used whenever you’re comparing two or more places in an XML document.

Users like Schematron document rules because they can customize the error message associated with each rule to have a user-appropriate meaning. This customization is more difficult with XML Schema, where an error message tells you where the error occurred within the file but may not return a user-friendly message. For this reason, sometimes Schematron is preferred in situations where error messages are sent to a system user.

All Schematron rules are expressed using XPath expressions. This means you can use simple path statements to select two parts of a document and do a comparison. Since native XML databases index each element specified by a path, only part of the document needs to be moved into RAM when running a rules check. Schematron rules can also be configured to perform date checks and run web service validations. Schematron is both simple and powerful. Many users say it’s one of the most underutilized features in the XML family of products.

Together, XML Schema and Schematron provide powerful and easy-to-use tools to design XML documents and validate their structures. Graphical tools and simple path expressions make these tools available to a wide audience. Making projects easier to use is a central theme of many XML projects.