use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.
the class SchematronResourcePure method applySchematronValidation.
@Nullable
public Document applySchematronValidation(@Nonnull final Node aXMLNode, @Nullable final String sBaseURI) throws Exception {
ValueEnforcer.notNull(aXMLNode, "XMLNode");
final SchematronOutputType aSO = applySchematronValidationToSVRL(aXMLNode, sBaseURI);
return new SVRLMarshaller().getAsDocument(aSO);
}
use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.
the class SchematronHelperFuncTest method testReadValidSchematronInvalidXML.
@Test
public void testReadValidSchematronInvalidXML() throws Exception {
final SchematronOutputType aSO = SchematronResourceSCH.fromClassPath(VALID_SCHEMATRON).applySchematronValidationToSVRL(new ClassPathResource(VALID_XMLINSTANCE + ".does.not.exist"));
assertNull("Invalid XML", aSO);
}
use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.
the class SchematronHelperFuncTest method testReadInvalidSchematronValidXML.
@Test
public void testReadInvalidSchematronValidXML() throws Exception {
final SchematronOutputType aSO = SchematronResourceSCH.fromClassPath(VALID_SCHEMATRON + ".does.not.exist").applySchematronValidationToSVRL(new ClassPathResource(VALID_XMLINSTANCE));
assertNull("Invalid Schematron", aSO);
}
use of com.helger.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.
the class Issue008Test 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.schematron.svrl.jaxb.SchematronOutputType in project ph-schematron by phax.
the class Issue101Test method _validateAndProduceSVRL.
private static void _validateAndProduceSVRL(@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception {
SchematronDebug.setSaveIntermediateXSLTFiles(true);
final SchematronResourceSCH aSCH = SchematronResourceSCH.fromFile(aSchematron);
aSCH.setAllowForeignElements(true);
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
assertNotNull(aSVRL);
LOGGER.info("SVRL:\n" + new SVRLMarshaller().getAsString(aSVRL));
assertEquals(2, SVRLHelper.getAllFailedAssertionsAndSuccessfulReports(aSVRL).size());
}
Aggregations