Merge pull request #595 from mkilian/xr-val-schematron-err
Treat all fatal XR schematron rules as errors, not as warnings.
This commit is contained in:
@@ -424,11 +424,6 @@ public class XMLValidator extends Validator {
|
|||||||
*/
|
*/
|
||||||
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity defaultSeverity) throws IrrecoverableValidationError {
|
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity defaultSeverity) throws IrrecoverableValidationError {
|
||||||
ISchematronResource aResSCH = null;
|
ISchematronResource aResSCH = null;
|
||||||
ESeverity severity=defaultSeverity;
|
|
||||||
if (defaultSeverity!=ESeverity.notice) {
|
|
||||||
severity=ESeverity.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
|
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
|
||||||
|
|
||||||
if (aResSCH != null) {
|
if (aResSCH != null) {
|
||||||
@@ -472,14 +467,15 @@ public class XMLValidator extends Validator {
|
|||||||
thisFailLocation = currentFailNode.getAttributes().getNamedItem("location").getNodeValue();
|
thisFailLocation = currentFailNode.getAttributes().getNamedItem("location").getNodeValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentFailNode.getAttributes().getNamedItem("flag") != null) {
|
ESeverity severity;
|
||||||
|
if (defaultSeverity == ESeverity.notice) {
|
||||||
|
severity = defaultSeverity;
|
||||||
|
} else if (currentFailNode.getAttributes().getNamedItem("flag") != null
|
||||||
|
&& currentFailNode.getAttributes().getNamedItem("flag").getNodeValue().equals("warning")) {
|
||||||
// the XR issues warnings with flag=warning
|
// the XR issues warnings with flag=warning
|
||||||
if (currentFailNode.getAttributes().getNamedItem("flag").getNodeValue().equals("warning")) {
|
severity = ESeverity.warning;
|
||||||
if (defaultSeverity!=ESeverity.notice) {
|
} else {
|
||||||
severity=ESeverity.warning;
|
severity = ESeverity.error;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeList failChilds = currentFailNode.getChildNodes();
|
NodeList failChilds = currentFailNode.getChildNodes();
|
||||||
|
|||||||
@@ -216,10 +216,10 @@ public class ZUGFeRDValidatorTest extends ResourceCase {
|
|||||||
|
|
||||||
assertThat(res).valueByXPath("count(//error)")
|
assertThat(res).valueByXPath("count(//error)")
|
||||||
.asInt()
|
.asInt()
|
||||||
.isEqualTo(1);
|
.isEqualTo(2);
|
||||||
assertThat(res).valueByXPath("count(//warning)")
|
assertThat(res).valueByXPath("count(//warning)")
|
||||||
.asInt()
|
.asInt()
|
||||||
.isEqualTo(3);
|
.isEqualTo(2);
|
||||||
|
|
||||||
assertThat(res).valueByXPath("count(//notice)")
|
assertThat(res).valueByXPath("count(//notice)")
|
||||||
.asInt()
|
.asInt()
|
||||||
|
|||||||
Reference in New Issue
Block a user