use of org.oclc.purl.dsdl.svrl.SchematronOutputType in project ph-schematron by phax.
the class Issue47Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(@Nonnull final File aSchematron, final File aXML) throws Exception {
final SchematronResourcePure aSCH = SchematronResourcePure.fromFile(aSchematron);
aSCH.setFunctionResolver((aFunctionName, aArity) -> {
System.out.println(aFunctionName + " - " + aArity);
return null;
});
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
assertNotNull(aSVRL);
if (false)
System.out.println(new SVRLMarshaller().getAsString(aSVRL));
}
use of org.oclc.purl.dsdl.svrl.SchematronOutputType in project ph-schematron by phax.
the class Issue64Test method validateAndProduceSVRL.
public static void validateAndProduceSVRL(@Nonnull final File aSchematron, final File aXML) throws Exception {
final SchematronResourcePure aSCH = SchematronResourcePure.fromFile(aSchematron);
aSCH.setErrorHandler(new LoggingPSErrorHandler());
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL(new FileSystemResource(aXML));
assertNotNull(aSVRL);
}
use of org.oclc.purl.dsdl.svrl.SchematronOutputType 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));
}
use of org.oclc.purl.dsdl.svrl.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 svrl = pure.applySchematronValidationToSVRL
// (anXMLSource);
final SchematronOutputType aSO = SchematronHelper.applySchematron(pure, anXMLSource);
final List<SVRLFailedAssert> aFailedAsserts = SVRLHelper.getAllFailedAssertions(aSO);
System.out.println(aFailedAsserts);
}
use of org.oclc.purl.dsdl.svrl.SchematronOutputType in project ph-schematron by phax.
the class PSXPathValidationHandlerSVRL method onStart.
@Override
public void onStart(@Nonnull final PSSchema aSchema, @Nullable final PSPhase aActivePhase, @Nullable final String sBaseURI) throws SchematronValidationException {
final SchematronOutputType aSchematronOutput = new SchematronOutputType();
if (aActivePhase != null)
aSchematronOutput.setPhase(aActivePhase.getID());
aSchematronOutput.setSchemaVersion(aSchema.getSchemaVersion());
aSchematronOutput.setTitle(_getTitleAsString(aSchema.getTitle()));
// Add namespace prefixes
for (final Map.Entry<String, String> aEntry : aSchema.getAsNamespaceContext().getPrefixToNamespaceURIMap().entrySet()) {
final NsPrefixInAttributeValues aNsPrefix = new NsPrefixInAttributeValues();
aNsPrefix.setPrefix(aEntry.getKey());
aNsPrefix.setUri(aEntry.getValue());
aSchematronOutput.getNsPrefixInAttributeValues().add(aNsPrefix);
}
m_aSchematronOutput = aSchematronOutput;
m_aSchema = aSchema;
m_sBaseURI = sBaseURI;
}
Aggregations