Search in sources :

Example 41 with SchematronOutputType

use of com.helger.schematron.svrl.jaxb.SchematronOutputType 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)

Example 42 with SchematronOutputType

use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.

the class IssueDita1Test method validateAndProduceSVRL.

public static void validateAndProduceSVRL(final File aSchematronFile, final File aXmlFile) throws Exception {
    final AbstractSchematronResource aSCH = SchematronResourcePure.fromFile(aSchematronFile);
    final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXmlFile));
    assertNotNull(aSVRL);
    if (true)
        System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) AbstractSchematronResource(com.helger.schematron.AbstractSchematronResource) FileSystemResource(com.helger.commons.io.resource.FileSystemResource)

Example 43 with SchematronOutputType

use of com.helger.schematron.svrl.jaxb.SchematronOutputType 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 aSO = pure.applySchematronValidationToSVRL(anXMLSource);
    final ICommonsList<SVRLFailedAssert> aFailedAsserts = SVRLHelper.getAllFailedAssertions(aSO);
    LOGGER.info(aFailedAsserts.toString());
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) SVRLFailedAssert(com.helger.schematron.svrl.SVRLFailedAssert) IReadableResource(com.helger.commons.io.resource.IReadableResource) FileSystemResource(com.helger.commons.io.resource.FileSystemResource) SchematronResourcePure(com.helger.schematron.pure.SchematronResourcePure)

Example 44 with SchematronOutputType

use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.

the class IssueGC7Test 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 AbstractSchematronResource pure = new SchematronResourcePure(aSchematron);
    final SchematronOutputType aSVRL = pure.applySchematronValidationToSVRL(anXMLSource);
    assertNotNull(aSVRL);
    if (false)
        System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) IReadableResource(com.helger.commons.io.resource.IReadableResource) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) FileSystemResource(com.helger.commons.io.resource.FileSystemResource) AbstractSchematronResource(com.helger.schematron.AbstractSchematronResource) SchematronResourcePure(com.helger.schematron.pure.SchematronResourcePure)

Example 45 with SchematronOutputType

use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.

the class IssueGC9Test 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 AbstractSchematronResource pure = new SchematronResourcePure(aSchematron);
    final SchematronOutputType aSVRL = pure.applySchematronValidationToSVRL(anXMLSource);
    assertNotNull(aSVRL);
    if (false)
        System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
Also used : SchematronOutputType(com.helger.schematron.svrl.jaxb.SchematronOutputType) IReadableResource(com.helger.commons.io.resource.IReadableResource) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) FileSystemResource(com.helger.commons.io.resource.FileSystemResource) AbstractSchematronResource(com.helger.schematron.AbstractSchematronResource) SchematronResourcePure(com.helger.schematron.pure.SchematronResourcePure)

Aggregations

SchematronOutputType (com.helger.schematron.svrl.jaxb.SchematronOutputType)59 SVRLMarshaller (com.helger.schematron.svrl.SVRLMarshaller)33 FileSystemResource (com.helger.commons.io.resource.FileSystemResource)32 Test (org.junit.Test)21 SchematronResourcePure (com.helger.schematron.pure.SchematronResourcePure)18 ClassPathResource (com.helger.commons.io.resource.ClassPathResource)15 IReadableResource (com.helger.commons.io.resource.IReadableResource)13 SchematronResourceSCH (com.helger.schematron.sch.SchematronResourceSCH)12 ISchematronResource (com.helger.schematron.ISchematronResource)11 AbstractSchematronResource (com.helger.schematron.AbstractSchematronResource)9 Document (org.w3c.dom.Document)9 LoggingPSErrorHandler (com.helger.schematron.pure.errorhandler.LoggingPSErrorHandler)7 IXPathConfig (com.helger.schematron.pure.xpath.IXPathConfig)6 XPathConfigBuilder (com.helger.schematron.pure.xpath.XPathConfigBuilder)6 Nonnull (javax.annotation.Nonnull)5 SVRLFailedAssert (com.helger.schematron.svrl.SVRLFailedAssert)4 MapBasedXPathFunctionResolver (com.helger.xml.xpath.MapBasedXPathFunctionResolver)4 File (java.io.File)4 LoggingPSValidationHandler (com.helger.schematron.pure.validation.LoggingPSValidationHandler)3 XQueryAsXPathFunctionConverter (com.helger.schematron.pure.xpath.XQueryAsXPathFunctionConverter)3