use of com.helger.schematron.svrl.SVRLMarshaller 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));
}
use of com.helger.schematron.svrl.SVRLMarshaller 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 aSO == null ? null : new SVRLMarshaller().getAsDocument(aSO);
}
use of com.helger.schematron.svrl.SVRLMarshaller in project ph-schematron by phax.
the class Issue20140523Test 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));
}
use of com.helger.schematron.svrl.SVRLMarshaller in project ph-schematron by phax.
the class Issue29Test method validateXmlUsingSchematron.
@Nullable
static SchematronOutputType validateXmlUsingSchematron(@Nonnull final IReadableResource aRes) {
SchematronOutputType ob = null;
// Must use the XSLT based version, because of "key" usage
final ISchematronResource aResSCH = new SchematronResourcePure(new ClassPathResource("issues/github29/pbs.sch"));
if (!aResSCH.isValidSchematron())
throw new IllegalArgumentException("Invalid Schematron!");
try {
final Document aDoc = aResSCH.applySchematronValidation(new ResourceStreamSource(aRes));
if (aDoc != null) {
final SVRLMarshaller marshaller = new SVRLMarshaller();
ob = marshaller.read(aDoc);
}
} catch (final Exception pE) {
pE.printStackTrace();
}
return ob;
}
use of com.helger.schematron.svrl.SVRLMarshaller in project ph-schematron by phax.
the class Issue54Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(@Nonnull final File aSchematron, final File aXML) throws Exception {
final ISchematronResource aSCH = SchematronResourcePure.fromFile(aSchematron);
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
assertNotNull(aSVRL);
if (false)
System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
Aggregations