xrechnung to be checked against EN16931 not Extended
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
- issue #255 support order-x
|
- issue #255 support order-x
|
||||||
|
- xr now checks en16931 profile not extended
|
||||||
|
- Validation errors now contain the filename of the failed xslt~schematron
|
||||||
|
|
||||||
2.3.4
|
2.3.4
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class XMLValidator extends Validator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* whether uri1 has the same meaning like uri1 (it has, if it only differs in the fragment, i.e. uri1#1==uri1#2 )
|
* whether uri1 has the same meaning like uri1 (it has, if it only differs in the fragment, i.e. uri1#1==uri1#2 )
|
||||||
|
*
|
||||||
* @param uri1 basis guideline ID
|
* @param uri1 basis guideline ID
|
||||||
* @param uri2 guideline ID to be checked
|
* @param uri2 guideline ID to be checked
|
||||||
* @return true if semantically identical
|
* @return true if semantically identical
|
||||||
@@ -233,20 +234,20 @@ public class XMLValidator extends Validator {
|
|||||||
LOGGER.debug("is EN16931");
|
LOGGER.debug("is EN16931");
|
||||||
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
|
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
|
||||||
xsltFilename = "/xslt/ZF_211/FACTUR-X_EN16931.xslt";
|
xsltFilename = "/xslt/ZF_211/FACTUR-X_EN16931.xslt";
|
||||||
|
} else 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/ZF_211/FACTUR-X_EN16931.xslt";
|
||||||
|
XrechnungSeverity = ESeverity.error;
|
||||||
} else if (isExtended) {
|
} else if (isExtended) {
|
||||||
LOGGER.debug("is EXTENDED");
|
LOGGER.debug("is EXTENDED");
|
||||||
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EXTENDED/FACTUR-X_EXTENDED.xsd", 18, EPart.fx);
|
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EXTENDED/FACTUR-X_EXTENDED.xsd", 18, EPart.fx);
|
||||||
xsltFilename = "/xslt/ZF_211/FACTUR-X_EXTENDED.xslt";
|
xsltFilename = "/xslt/ZF_211/FACTUR-X_EXTENDED.xslt";
|
||||||
} else if (isXRechnung) {
|
}
|
||||||
LOGGER.debug("is XRechnung");
|
|
||||||
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EXTENDED/FACTUR-X_EXTENDED.xsd", 18, EPart.fx);
|
|
||||||
xsltFilename = "/xslt/ZF_211/FACTUR-X_EN16931.xslt";
|
|
||||||
XrechnungSeverity = ESeverity.error;
|
|
||||||
} /*
|
|
||||||
* ISchematronResource aResSCH = SchematronResourceXSLT.fromFile(new File(
|
|
||||||
* "/Users/jstaerk/workspace/ZUV/src/main/resources/ZUGFeRDSchematronStylesheet.xsl"
|
|
||||||
* ));
|
|
||||||
*/
|
|
||||||
|
|
||||||
// takes around 10 Seconds. //
|
// takes around 10 Seconds. //
|
||||||
// http://www.bentoweb.org/refs/TCDL2.0/tsdtf_schematron.html // explains that
|
// http://www.bentoweb.org/refs/TCDL2.0/tsdtf_schematron.html // explains that
|
||||||
@@ -306,8 +307,7 @@ public class XMLValidator extends Validator {
|
|||||||
.setSection(25).setPart(EPart.fx));
|
.setSection(25).setPart(EPart.fx));
|
||||||
|
|
||||||
}
|
}
|
||||||
} else
|
} else if ((!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"))
|
||||||
if ((!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"))
|
|
||||||
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"))
|
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"))
|
||||||
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"))) {
|
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"))) {
|
||||||
//zf 1.0
|
//zf 1.0
|
||||||
@@ -403,7 +403,7 @@ public class XMLValidator extends Validator {
|
|||||||
final FailedAssert failedAssert = (FailedAssert) object;
|
final FailedAssert failedAssert = (FailedAssert) object;
|
||||||
LOGGER.info("FailedAssert ", failedAssert);
|
LOGGER.info("FailedAssert ", failedAssert);
|
||||||
|
|
||||||
context.addResultItem(new ValidationResultItem(severity, SVRLHelper.getAsString(failedAssert.getText()))
|
context.addResultItem(new ValidationResultItem(severity, SVRLHelper.getAsString(failedAssert.getText())+" (From "+xsltFilename+")")
|
||||||
.setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section)
|
.setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section)
|
||||||
.setPart(EPart.fx));
|
.setPart(EPart.fx));
|
||||||
failedRules++;
|
failedRules++;
|
||||||
|
|||||||
Reference in New Issue
Block a user