Search in sources :

Example 6 with SchematronResourceSCH

use of com.helger.schematron.xslt.SchematronResourceSCH in project ph-schematron by phax.

the class IssueXsltKeyTest 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 SchematronResourceSCH(aSchematron);
    final SchematronOutputType aSVRL = pure.applySchematronValidationToSVRL(anXMLSource);
    assertNotNull(aSVRL);
    if (false)
        System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
Also used : SchematronOutputType(org.oclc.purl.dsdl.svrl.SchematronOutputType) SchematronResourceSCH(com.helger.schematron.xslt.SchematronResourceSCH) 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)

Example 7 with SchematronResourceSCH

use of com.helger.schematron.xslt.SchematronResourceSCH 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));
}
Also used : SchematronOutputType(org.oclc.purl.dsdl.svrl.SchematronOutputType) SchematronResourceSCH(com.helger.schematron.xslt.SchematronResourceSCH) SVRLMarshaller(com.helger.schematron.svrl.SVRLMarshaller) FileSystemResource(com.helger.commons.io.resource.FileSystemResource)

Aggregations

SchematronResourceSCH (com.helger.schematron.xslt.SchematronResourceSCH)7 FileSystemResource (com.helger.commons.io.resource.FileSystemResource)6 SVRLMarshaller (com.helger.schematron.svrl.SVRLMarshaller)6 SchematronOutputType (org.oclc.purl.dsdl.svrl.SchematronOutputType)6 ISchematronResource (com.helger.schematron.ISchematronResource)3 SchematronResourcePure (com.helger.schematron.pure.SchematronResourcePure)3 ICommonsList (com.helger.commons.collection.impl.ICommonsList)2 IError (com.helger.commons.error.IError)2 EErrorLevel (com.helger.commons.error.level.EErrorLevel)2 IErrorList (com.helger.commons.error.list.IErrorList)2 IReadableResource (com.helger.commons.io.resource.IReadableResource)2 ReadableResourceString (com.helger.commons.io.resource.inmemory.ReadableResourceString)2 StringHelper (com.helger.commons.string.StringHelper)2 AbstractSchematronResource (com.helger.schematron.AbstractSchematronResource)2 ESchematronMode (com.helger.schematron.ESchematronMode)2 CollectingPSErrorHandler (com.helger.schematron.pure.errorhandler.CollectingPSErrorHandler)2 SVRLHelper (com.helger.schematron.svrl.SVRLHelper)2 SchematronResourceXSLT (com.helger.schematron.xslt.SchematronResourceXSLT)2 CollectingTransformErrorListener (com.helger.xml.transform.CollectingTransformErrorListener)2 TransformSourceFactory (com.helger.xml.transform.TransformSourceFactory)2