Meaning
Validation languages allow for the assertion of complex business constraints that exceed the capabilities of grammar-based schemas. These schematron rules operate on the tree structure of an XML document to find patterns and relationships. They provide a way to express requirements that involve multiple elements or attributes.
This system works alongside traditional validation to provide a more complete check.
Assertion Logic
Designers of the system write statements that must be true for the document to be valid. The schematron rules test these assertions using path expressions that navigate the document. If an assertion is false, the system flags the specific location of the error.
Error Messaging
Customized feedback informs the user exactly why a document failed the check. Within the schematron rules, the author can include specific text that explains the business rule being enforced. This feature makes it much easier to understand and fix a problem.
It provides a level of detail that is usually missing from generic validation reports.
Document Context
Focus shifts to the relationship between different parts of the file rather than just the individual fields. The schematron rules can verify that the sum of a list of prices matches a total field at the top of the invoice. This ability to look across the entire document ensures that the internal data is consistent.
It allows for the enforcement of rules that are specific to a particular document type or business transaction.