diff --git a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
index 4392448e..c2124b87 100644
--- a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
+++ b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
@@ -269,13 +269,13 @@ public class XMLValidator extends Validator {
// saxon java net.sf.saxon.Transform -o tcdl2.0.tsdtf.sch.tmp.xsl -s
// tcdl2.0.tsdtf.sch iso_svrl.xsl
- } else if (root.getLocalName().equalsIgnoreCase("Invoice")) {
+ } else if (root.getLocalName().equalsIgnoreCase("Invoice") || root.getLocalName().equalsIgnoreCase("CreditNote") ) {
context.setGeneration("2");
context.setFormat("UBL");
isXRechnung = context.getProfile().contains("xrechnung");
// UBL
LOGGER.debug("UBL");
- validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-Invoice-2.1.xsd", 18, EPart.fx);
+ validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-"+root.getLocalName()+"-2.1.xsd", 18, EPart.fx);
xsltFilename = "/xslt/en16931schematron/EN16931-UBL-validation.xslt";
mainSchematronSectionErrorTypeCode=24;
diff --git a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java
index 8b6022f5..5477b25c 100644
--- a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java
+++ b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java
@@ -298,6 +298,22 @@ public class XMLValidatorTest extends ResourceCase {
noExceptions = false;
}
assertTrue(noExceptions);
+ tempFile = getResourceAsFile("ubl-tc434-creditnote1.xml");
+ try {
+ xv.setFilename(tempFile.getAbsolutePath());
+ xv.validate();
+
+ Source source = Input.fromString("" + xv.getXMLResult() + "").build();
+ String content = xpath.evaluate("/validation/summary/@status", source);
+ assertEquals("valid", content);
+
+
+ } catch (IrrecoverableValidationError e) {
+
+ noExceptions = false;
+ }
+ assertTrue(noExceptions);
+
}
diff --git a/validator/src/test/resources/ubl-tc434-creditnote1.xml b/validator/src/test/resources/ubl-tc434-creditnote1.xml
new file mode 100644
index 00000000..b9380fb3
--- /dev/null
+++ b/validator/src/test/resources/ubl-tc434-creditnote1.xml
@@ -0,0 +1,136 @@
+
+
+
+ urn:cen.eu:en16931:2017
+ urn:fdc:peppol.eu:2017:poacc:billing:01:1.0
+ 018304 / 28865
+ 2019-09-23
+ 381
+ EUR
+ 018304 / 28865
+
+ 2019-02-01
+ 2019-02-28
+
+
+
+ 0000000196
+
+ My Supplier Company N.V.
+
+
+ De Grote Meir 22
+ ANTWERPEN
+ 2000
+
+ BE
+
+
+
+ BE0000000196
+
+ VAT
+
+
+
+ My Supplier Company
+ 0000000196
+
+
+ john.doole@mysuppliercompany.be
+
+
+
+
+
+ 0000000295
+
+ My Customer Company S.A.
+
+
+ Boulevard Sint Michel 53
+ BRUXELLES
+ 1000
+
+ BE
+
+
+
+ BE0000000295
+
+ VAT
+
+
+
+ My Customer Company
+ 0000000295
+
+
+ pete.smith@mycustomercompany.be
+
+
+
+
+ 1
+ 010676609538
+
+ BE91000000143476
+
+ BPOTBEB1
+
+
+
+
+ 0.00
+
+ 100.11
+ 0.00
+
+ E
+ 0.00
+ Taxes are not applicable
+
+ VAT
+
+
+
+
+
+ 100.11
+ 100.11
+ 100.11
+ 100.11
+
+
+ 1
+ 1.00
+ 100.11
+
+ Exonération du versement du PP
+ Exonération du versement du PP
+
+ V55
+
+
+ E
+ 0.00
+
+ VAT
+
+
+
+ 2
+ Contributions - précompte professionnel
+
+
+
+ 100.11
+
+
+