use of org.oclc.purl.dsdl.svrl.SchematronOutputType in project ph-schematron by phax.
the class IssueGC6Test 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 org.oclc.purl.dsdl.svrl.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));
}
use of org.oclc.purl.dsdl.svrl.SchematronOutputType in project ph-schematron by phax.
the class SVRLMarshallerTest method testWriteValid.
@Test
public void testWriteValid() throws Exception {
final Document aDoc = SchematronResourceSCH.fromClassPath(VALID_SCHEMATRON).applySchematronValidation(new ClassPathResource(VALID_XMLINSTANCE));
assertNotNull(aDoc);
final SchematronOutputType aSO = new SVRLMarshaller().read(aDoc);
// Create XML
final Document aDoc2 = new SVRLMarshaller().getAsDocument(aSO);
assertNotNull(aDoc2);
assertEquals(CSVRL.SVRL_NAMESPACE_URI, aDoc2.getDocumentElement().getNamespaceURI());
// Create String
final String sDoc2 = new SVRLMarshaller().getAsString(aSO);
assertTrue(StringHelper.hasText(sDoc2));
assertTrue(sDoc2.contains(CSVRL.SVRL_NAMESPACE_URI));
}
use of org.oclc.purl.dsdl.svrl.SchematronOutputType in project ph-schematron by phax.
the class SVRLMarshallerTest method testReadInvalidSchematron.
@Test
public void testReadInvalidSchematron() {
try {
// Read null
new SVRLMarshaller().read((Node) null);
fail();
} catch (final NullPointerException ex) {
}
try {
// Read empty XML
new SVRLMarshaller().read(XMLFactory.newDocument());
fail();
} catch (final NullPointerException ex) {
}
// Read XML that is not SVRL
final SchematronOutputType aSVRL = new SVRLMarshaller().read(new ClassPathResource("test-xml/goodOrder01.xml"));
assertNull(aSVRL);
}
use of org.oclc.purl.dsdl.svrl.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 aSO == null ? null : new SVRLMarshaller().getAsDocument(aSO);
}
Aggregations