Skip to content

Commit

Permalink
closes #532
Browse files Browse the repository at this point in the history
  • Loading branch information
jstaerk committed Oct 29, 2024
1 parent 1496262 commit aeb4918
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,16 @@ public void validateXR(String xml, ESeverity errorImpact) throws IrrecoverableVa
* @param xml the xml to be checked
* @param xsltFilename the filename of the intermediate XSLT file
* @param section the error type code, if one arises
* @param severity how serious a error should be treated - may only be notice
* @param defaultSeverity how serious a error should be treated - may only be notice
* @throws IrrecoverableValidationError if anything happened that prevents further checks
*/
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity severity) throws IrrecoverableValidationError {
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity defaultSeverity) throws IrrecoverableValidationError {
ISchematronResource aResSCH = null;
ESeverity severity=defaultSeverity;
if (defaultSeverity!=ESeverity.notice) {
severity=ESeverity.error;
}

aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);

if (aResSCH != null) {
Expand Down Expand Up @@ -465,6 +470,16 @@ public void validateSchematron(String xml, String xsltFilename, int section, ESe
thisFailLocation = currentFailNode.getAttributes().getNamedItem("location").getNodeValue();
}

if (currentFailNode.getAttributes().getNamedItem("flag") != null) {
// the XR issues warnings with flag=warning
if (currentFailNode.getAttributes().getNamedItem("flag").getNodeValue().equals("warning")) {
if (defaultSeverity!=ESeverity.notice) {
severity=ESeverity.warning;
}
}

}

NodeList failChilds = currentFailNode.getChildNodes();
for (int failChildIndex = 0; failChildIndex < failChilds.getLength(); failChildIndex++) {
if (failChilds.item(failChildIndex).getLocalName() != null) {
Expand Down
3 changes: 0 additions & 3 deletions validator/src/test/resources/invalidXRV30.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
<ram:CityName>[Seller city]</ram:CityName>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
<ram:URIUniversalCommunication>
<ram:URIID schemeID="EM">[email protected]</ram:URIID>
</ram:URIUniversalCommunication>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA">DE 123456789</ram:ID>
</ram:SpecifiedTaxRegistration>
Expand Down

0 comments on commit aeb4918

Please sign in to comment.