What is Schematron? A language for making assertions about the presence or absence of patterns in XML documents.
Simon St Laurent, Technical Journalist and O’Reilly Editor, xml-DEV list, 19 May 2016
What is Schematron used for? Business rules validation, data reporting, general validation, quality control, quality assurance, firewalling, filtering, constraint checking, naming and design rules checking, statistical consistency, data exploration, transformation testing, feature extraction, house-style-rules checking
What makes Schematron unique? Schematron is very simple (only five important elements), very powerful (it can express many kinds of constraints impossible in other schema languages), very diverse (it can be used for business rules, reports as well as the kinds of static constraints usually associated with schemas.)
It places particular emphasis on capturing constraints in human language assertions and generating appropriate human-language diagnostics: this allows a level of user-friendliness not available in other schema languages.
As well, the phase mechanism let you choose which set of patterns you want to look for next, to suit your workflow and to handle versions and variants.
Schematron schemas can validate co-constraints (if some data is one value, some other data should be constrained to certain values) and even jump across links and between XML documents to check constraints. The diagnostics facility allows multi-lingual schemas.
To Why Schematron is Different
(Plus summary of all features) >
Who uses Schematron? Schematron is an ISO standard which has uptake in many industries, notably the financial, insurance, governmental record exchange, police, and technical and reference publishing sectors. Some examples:
Government and International Agencies
- US National Emergency Management System (NEMSYS)
- NASA Planetary Data System
- Schematron Files US Department of Defense Data Services Environment.
- National Environmental Information Exchange Network (PDF) US
- CITES Electronic Permitting Toolkit (PDF) Convention on International Trade in Endangered Species of Wild
Fauna and Flora
- CITES Electronic Permitting Toolkit (PDF) Convention on International Trade in Endangered Species of Wild
- Water Data Transport Format (PDF) Australian Bureau of Meteorology
- Standard Business Reporting Program forms validation Australian Taxation Office. See also
PAYG forms validator - Japanese Local Government Periodic Reports (PDF) by Murata Makoto (conference paper)
- Open Vulnerability and Assessment Language (OVAL) US Dept Homeland Security
Government and International Agencies (Europe)
- PEPPOL Pan-European Public Procurement Online
- European Commission e-trustex secure document transfer platform
- HM Revenue and Customs (PDF) UK
- Aeronautical Information Exchange Rule Checker EUROCONTROL
- Large scale validation of millions of UBL
Invoices with XML Schema and Schematron (PDF) Danish Agency for Governmental Management/Danish Ministry of Finance/KPMG
- UBL Northern European Subset
Universal Business Language - Benchmarking Norwegian Municipal Websites (PDF) (conference paper)
- Statistical data confidentiality (PDF) Joint UNECE/Eurostat work session (paper)
- SeaDataNet The EU Pan-European Infrastructure for Ocean and Marine Data
Management use Schematron to “quality control the
maintenance metadata validation” in particular for “field content verification. - Chemical test templates OECD Environment Directorate
Naming and Design Rules
- NIEM Naming and Design
Rules checking US National Information Exchange Model Tools - CDA guideline validation for HL7 NIST (Health)
- UBL Code list validation methodology by Ken Holman
- ANZLIC Profile Validation Australian Govt Office of Spatial Data Management
- Naming and Design Rules Toolkit (PDF) NIST
What implementations are available? The major implementation is the skeleton implementation here at Schematron.com. This is an open source implementation which is quite mature, having been in continuous use and development since early 2000. This implementation uses XSLT1 and XSLT2 and can run in any environment that can invoke XSLT transformations.
Is Schematron a replacement for XSD? While Schematron can express most of the same constraints that can be expressed in grammar-based schema languages such as XSD (W3C XML Schemas), RELAX NG and DTDs, very often it is used as an adjunct to supplement the intrinsic weak points of grammars if necessary, or to express constraints that may belong to a different conceptual layer such as business rules. (The instigator of Schematron also was a member of the working groups that defined XML DTDs, RELAX NG and XSD, so by design their weaknesses in key practical areas are precisely what Schematron is strong at: comprehensible error messages in terms users understand, open schemas that only validate the things of interest at a particular phase in the documents life or pipeline, a small set of simple elements that is easy to learn and hack, integration into an XML- or DOM-based tool chain, making the power of XPath available without the complexity of XSLT.)