Search in sources :

Example 1 with LoggingPSValidationHandler

use of com.helger.schematron.pure.validation.LoggingPSValidationHandler in project ph-schematron by phax.

the class Issue088Test method _validateAndProduceSVRL.

private static void _validateAndProduceSVRL(@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception {
    final SchematronResourcePure aSCH = SchematronResourcePure.fromFile(aSchematron);
    aSCH.setCustomValidationHandler(new LoggingPSValidationHandler());
    // Perform validation
    final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
    assertNotNull(aSVRL);
    final String sSVRL = new SVRLMarshaller().getAsString(aSVRL);
    assertNotNull(sSVRL);
    if (false)
        LOGGER.info("SVRL:\n" + sSVRL);
    assertTrue(SVRLHelper.getAllFailedAssertionsAndSuccessfulReports(aSVRL).isEmpty());
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) LoggingPSValidationHandler(com.helger.schematron.pure.validation.LoggingPSValidationHandler) FileSystemResource(com.helger.commons.io.resource.FileSystemResource) SchematronResourcePure(com.helger.schematron.pure.SchematronResourcePure)

Example 2 with LoggingPSValidationHandler

use of com.helger.schematron.pure.validation.LoggingPSValidationHandler in project ph-schematron by phax.

the class Issue099Test method _validateAndProduceSVRL.

private static void _validateAndProduceSVRL(@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception {
    SchematronDebug.setSaveIntermediateXSLTFiles(true);
    final StopWatch aSW = StopWatch.createdStarted();
    LOGGER.info("Start");
    final ISchematronResource aSCH = SchematronResourcePure.fromFile(aSchematron);
    if (aSCH instanceof SchematronResourcePure)
        ((SchematronResourcePure) aSCH).setCustomValidationHandler(new LoggingPSValidationHandler());
    // Perform validation
    final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
    assertNotNull(aSVRL);
    aSW.stop();
    LOGGER.info("Took " + aSW.getDuration());
    LOGGER.info("SVRL:\n" + new SVRLMarshaller().getAsString(aSVRL));
    assertTrue(SVRLHelper.getAllFailedAssertionsAndSuccessfulReports(aSVRL).isEmpty());
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) ISchematronResource(com.helger.schematron.ISchematronResource) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) LoggingPSValidationHandler(com.helger.schematron.pure.validation.LoggingPSValidationHandler) FileSystemResource(com.helger.commons.io.resource.FileSystemResource) SchematronResourcePure(com.helger.schematron.pure.SchematronResourcePure) StopWatch(com.helger.commons.timing.StopWatch)

Example 3 with LoggingPSValidationHandler

use of com.helger.schematron.pure.validation.LoggingPSValidationHandler in project ph-schematron by phax.

the class Issue126Test method _validateAndProduceSVRL.

private static void _validateAndProduceSVRL(@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception {
    final SchematronResourcePure aSCH = SchematronResourcePure.fromFile(aSchematron);
    aSCH.setCustomValidationHandler(new LoggingPSValidationHandler());
    // Perform validation
    final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
    assertNotNull(aSVRL);
    final String sSVRL = new SVRLMarshaller().getAsString(aSVRL);
    assertNotNull(sSVRL);
    if (true)
        LOGGER.info("SVRL:\n" + sSVRL);
    assertEquals(1, SVRLHelper.getAllFailedAssertionsAndSuccessfulReports(aSVRL).size());
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) LoggingPSValidationHandler(com.helger.schematron.pure.validation.LoggingPSValidationHandler) FileSystemResource(com.helger.commons.io.resource.FileSystemResource) SchematronResourcePure(com.helger.schematron.pure.SchematronResourcePure)

Aggregations

FileSystemResource (com.helger.commons.io.resource.FileSystemResource)3 SchematronResourcePure (com.helger.schematron.pure.SchematronResourcePure)3 LoggingPSValidationHandler (com.helger.schematron.pure.validation.LoggingPSValidationHandler)3 SVRLMarshaller (com.helger.schematron.svrl.SVRLMarshaller)3 SchematronOutputType (com.helger.schematron.svrl.jaxb.SchematronOutputType)3 StopWatch (com.helger.commons.timing.StopWatch)1 ISchematronResource (com.helger.schematron.ISchematronResource)1