You can check out SchematronAssert (expansion: my code). It is intended primarily for unit testing, but you can also use it for regular code. It is implemented using XSLT.
Device Test Example:
ValidationOutput result = in(booksDocument) .forEvery("book") .check("author") .validate(); assertThat(result).hasNoErrors();
Standalone verification example:
StreamSource schemaSource = new StreamSource(... your schematron schema ...); StreamSource xmlSource = new StreamSource(... your xml document ... ); StreamResult output = ... here your SVRL will be saved ...
Working with the SVRL Object View:
ValidationOutput output = validator.validate(xmlSource, schemaSource);
j_maly
source share