use of com.helger.schematron.pure.SchematronResourcePure in project ph-schematron by phax.
the class Issue47Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(@Nonnull final File aSchematron, final File aXML) throws Exception {
final SchematronResourcePure aSCH = SchematronResourcePure.fromFile(aSchematron);
aSCH.setFunctionResolver((aFunctionName, aArity) -> {
System.out.println(aFunctionName + " - " + aArity);
return null;
});
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
assertNotNull(aSVRL);
if (false)
System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
use of com.helger.schematron.pure.SchematronResourcePure in project ph-schematron by phax.
the class Issue4Test method testReadFromUNCWithInclude.
@Test
public void testReadFromUNCWithInclude() throws Exception {
final File aSchematronFile = new File("\\\\PC61826\\share\\example-8-5.sch");
if (aSchematronFile.exists()) {
final SchematronResourcePure aResPure = SchematronResourcePure.fromFile(aSchematronFile);
aResPure.setErrorHandler(new LoggingPSErrorHandler());
aResPure.validateCompletely();
assertTrue(aResPure.isValidSchematron());
} else
s_aLogger.info("Test ignored because file does not exist");
}
use of com.helger.schematron.pure.SchematronResourcePure in project ph-schematron by phax.
the class Issue64Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(@Nonnull final File aSchematron, final File aXML) throws Exception {
final SchematronResourcePure aSCH = SchematronResourcePure.fromFile(aSchematron);
aSCH.setErrorHandler(new LoggingPSErrorHandler());
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
assertNotNull(aSVRL);
}
use of com.helger.schematron.pure.SchematronResourcePure in project ph-schematron by phax.
the class IssueGC5Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(final File schematron, final File xml) throws Exception {
final IReadableResource aSchematron = new FileSystemResource(schematron.getAbsoluteFile());
final IReadableResource anXMLSource = new FileSystemResource(xml.getAbsoluteFile());
final SchematronResourcePure pure = new SchematronResourcePure(aSchematron);
// final FileOutputStream fos = new FileOutputStream (result);
// final Result res = new StreamResult (fos);
// res.setSystemId(result.getAbsolutePath());
// final SchematronOutputType svrl = pure.applySchematronValidationToSVRL
// (anXMLSource);
final SchematronOutputType aSO = SchematronHelper.applySchematron(pure, anXMLSource);
final List<SVRLFailedAssert> aFailedAsserts = SVRLHelper.getAllFailedAssertions(aSO);
System.out.println(aFailedAsserts);
}
Aggregations