-
Notifications
You must be signed in to change notification settings - Fork 36
Home
ph-schematron is a Java library that validates XML documents via ISO Schematron.
Schematron is an XML based validation language to validate XML documents.
Schematron is part of the ISO 19757 standard "Information technology — Document Schema Definition Languages (DSDL)", Part 3 "Rule-based validation — Schematron". Until version 2016 the standard was free, since the 2020 version the standard needs to be bought.
This Wiki should provide you with all the information you need for version 6 and later releases. See the menu on the right side for your sub-navigation.
The following table shows the different Schematron implementations supported by ph-schematron:
Schematron implementation | Rule representation | Module | Handler Class | Comment |
---|---|---|---|---|
ISO Schematron | SCH | ph-schematron-xslt | SchematronResourceSCH |
Inefficient, as the SCH is converted to XSLT all the time |
ISO Schematron | XSLT | ph-schematron-xslt | SchematronResourceXSLT |
|
SchXslt | SCH | ph-schematron-schxslt | SchematronResourceSchXslt_XSLT2 |
Inefficient, as the SCH is converted to XSLT all the time. After conversion use SchematronResourceXSLT
|
Pure | SCH | ph-schematron-pure | SchematronResourcePure |
Is limited to XPath expressions. Can not handle XSLT expressions |
Using the [Maven plugin] is a good way to convert the SCH files to XSLT files at build time.
The project module structure was heavily reworked for version 6 to be more modular and flexible.
This module contains the basic shared components used by the different implementation modules (see below). This module is always required.
It transitively depends on ph-commons, ph-xml, ph-jaxb, SLF4J and Saxon HE.
This module uses the original XSLTs provided by the https://github.com/schematron/schematron project.
The dependency for ph-schematron-xslt
looks like this, replacing x.y.z
with the latest version number:
<dependency>
<groupId>com.helger.schematron</groupId>
<artifactId>ph-schematron-xslt</artifactId>
<version>x.y.z</version>
</dependency>
This module uses the XSLTs provided by the https://github.com/schxslt/schxslt project. This module was added for the v6 major release and might need additional tweeking, especially in the direction of parameters and configurability.
The dependency for ph-schematron-schxslt
looks like this, replacing x.y.z
with the latest version number:
<dependency>
<groupId>com.helger.schematron</groupId>
<artifactId>ph-schematron-schxslt</artifactId>
<version>x.y.z</version>
</dependency>
Alternatively ph-schematron-pure
offers a Java-native implementation for the Schematron XPath binding which offers superior performance over the XSLT approach but can only be used, if the Schematron rules consist purely of XPath expressions and don't contain any XSLT.
The dependency for ph-schematron-pure
looks like this, replacing x.y.z
with the latest version number:
<dependency>
<groupId>com.helger.schematron</groupId>
<artifactId>ph-schematron-pure</artifactId>
<version>x.y.z</version>
</dependency>
Note: up to and including v5.x the Maven groupId was com.helger
.
It is a validator for Schematron definitions based on RelaxNG definition. This is NOT for validation XML documents against Schematron rules.
Add the following to your pom.xml to use this artifact, replacing x.y.z
with the latest version number:
<dependency>
<groupId>com.helger.schematron</groupId>
<artifactId>ph-schematron-validator</artifactId>
<version>x.y.z</version>
</dependency>
On Twitter: Follow @philiphelger
Donation link: https://paypal.me/PhilipHelger
It is appreciated if you star the GitHub project if you like it.