Fix compile error

This commit is contained in:
James Agnew 2018-12-28 12:11:19 -05:00
parent 1bfa29bbcc
commit 4f16fea580
1 changed files with 183 additions and 213 deletions

View File

@ -178,36 +178,6 @@ public class XmlValidator {
return doc.getDocumentElement();
}
public void checkBySchematron(String filename, String sch, boolean wantThrow) throws IOException, ParserConfigurationException, SAXException, FileNotFoundException, FHIRException {
DocumentBuilderFactory factory;
DocumentBuilder builder;
Document doc;
byte[] out = null;
try {
out = Utilities.saxonTransform(transforms, schemas.get(sch), transforms.get("iso_svrl_for_xslt2.xsl"));
out = Utilities.saxonTransform(transforms, TextFile.fileToBytes(filename), out);
} catch (Throwable e) {
errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, -1, -1, filename+":"+sch, e.getMessage(), IssueSeverity.ERROR));
if (wantThrow)
throw new FHIRException("Error validating " + filename + " with schematrons", e);
}
factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
builder = factory.newDocumentBuilder();
doc = builder.parse(new ByteArrayInputStream(out));
NodeList nl = doc.getDocumentElement().getElementsByTagNameNS("http://purl.oclc.org/dsdl/svrl", "failed-assert");
if (nl.getLength() > 0) {
logger.log("Schematron Validation Failed for " + filename, LogMessageType.Error);
for (int i = 0; i < nl.getLength(); i++) {
Element e = (Element) nl.item(i);
logger.log(" @" + e.getAttribute("location") + ": " + e.getTextContent(), LogMessageType.Error);
errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, -1, -1, filename+":"+e.getAttribute("location"), e.getTextContent(), IssueSeverity.ERROR));
}
if (wantThrow)
throw new FHIRException("Schematron Validation Failed for " + filename);
}
}
}