Skip to content

Commit

Permalink
upgraded ph-schematron
Browse files Browse the repository at this point in the history
  • Loading branch information
jstaerk committed Apr 21, 2024
1 parent e3ed176 commit 43d9794
Show file tree
Hide file tree
Showing 9 changed files with 4,159 additions and 688 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- zugferdimporter to accept xml files
- UBL importer to also parse contacts
- https://github.com/ZUGFeRD/mustangproject/pull/369
- upgrade ph-scematron from 6.3.3 to 8

2.10.0
=======
Expand Down
13 changes: 12 additions & 1 deletion validator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@
<version>2.1.3</version>
</dependency>
<!-- for ph-schematron -->
<dependency>
<groupId>com.helger.commons</groupId>
<artifactId>ph-commons</artifactId>
<version>11.1.6</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
</dependency>
<!-- /for ph-schematron -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down Expand Up @@ -88,7 +99,7 @@
<dependency>
<groupId>com.helger.schematron</groupId>
<artifactId>ph-schematron-xslt</artifactId>
<version>6.3.3</version>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>com.helger</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,20 @@ public void validate() throws IrrecoverableValidationError {
LOGGER.debug("UBL");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-Invoice-2.1.xsd", 18, EPart.fx);
xsltFilename = "/xslt/UBL_21/EN16931-UBL-validation.xsl";
validateSchematron(zfXML, xsltFilename, 24, ESeverity.error);

if (isXRechnung) {
LOGGER.debug("is XRechnung");
/*
the validation against the XRechnung Schematron will happen below but a
XRechnung is a EN16931 subset so the validation vis a vis FACTUR-X_EN16931.xslt=schematron also has to pass
* */
//validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
xsltFilename = "/xslt/XR_30/XRechnung-UBL-validation.xslt";
String xrVersion=context.getProfile().substring(context.getProfile().length()-3).replace(".","");
if (!xrVersion.equals("12")&&!xrVersion.equals("20")&&!xrVersion.equals("21")&&!xrVersion.equals("22")&&!xrVersion.equals("23")&&!xrVersion.equals("30")) {
throw new Exception("Unsupported XR version");
}
LOGGER.debug("is XRechnung v"+xrVersion);
xsltFilename = "/xslt/XR_"+xrVersion+"/XRechnung-UBL-validation.xslt";
XrechnungSeverity = ESeverity.error;

}
Expand Down
579 changes: 579 additions & 0 deletions validator/src/main/resources/xslt/XR_12/XRechnung-UBL-validation.xslt

Large diffs are not rendered by default.

721 changes: 721 additions & 0 deletions validator/src/main/resources/xslt/XR_20/XRechnung-UBL-validation.xslt

Large diffs are not rendered by default.

779 changes: 779 additions & 0 deletions validator/src/main/resources/xslt/XR_21/XRechnung-UBL-validation.xslt

Large diffs are not rendered by default.

This file was deleted.

941 changes: 941 additions & 0 deletions validator/src/main/resources/xslt/XR_22/XRechnung-UBL-validation.xslt

Large diffs are not rendered by default.

1,119 changes: 1,119 additions & 0 deletions validator/src/main/resources/xslt/XR_23/XRechnung-UBL-validation.xslt

Large diffs are not rendered by default.

0 comments on commit 43d9794

Please sign in to comment.