use of com.helger.commons.io.resource.FileSystemResource in project ph-schematron by phax.
the class SchematronResourceSCHCacheTest method testInvalidSchematron.
@Test
public void testInvalidSchematron() {
assertFalse(new SchematronResourceSCH(new ClassPathResource("test-sch/invalid01.sch")).isValidSchematron());
assertFalse(new SchematronResourceSCH(new ClassPathResource("test-sch/this.file.does.not.exists")).isValidSchematron());
assertFalse(new SchematronResourceSCH(new FileSystemResource("src/test/resources/test-sch/invalid01.sch")).isValidSchematron());
assertFalse(new SchematronResourceSCH(new FileSystemResource("src/test/resources/test-sch/this.file.does.not.exists")).isValidSchematron());
}
use of com.helger.commons.io.resource.FileSystemResource 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.commons.io.resource.FileSystemResource 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.commons.io.resource.FileSystemResource in project ph-schematron by phax.
the class Issue8Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(@Nonnull final File aSchematron, final File aXML) throws Exception {
final SchematronResourceSCH aSCH = SchematronResourceSCH.fromFile(aSchematron);
// Assign custom parameters
aSCH.parameters().put("xyz", "mobile");
aSCH.parameters().put("expected", "");
if (false)
System.out.println(XMLWriter.getNodeAsString(aSCH.getXSLTProvider().getXSLTDocument()));
// 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.commons.io.resource.FileSystemResource 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