use of org.oclc.purl.dsdl.svrl.FailedAssert in project ph-schematron by phax.
the class PSXPathValidationHandlerSVRL method onFailedAssert.
@Override
@Nonnull
public EContinue onFailedAssert(@Nonnull final PSAssertReport aAssertReport, @Nonnull final String sTestExpression, @Nonnull final Node aRuleMatchingNode, final int nNodeIndex, @Nullable final Object aContext) throws SchematronValidationException {
if (!(aContext instanceof PSXPathBoundAssertReport))
throw new SchematronValidationException("The passed context must be an XPath object but is a " + aContext);
final PSXPathBoundAssertReport aBoundAssertReport = (PSXPathBoundAssertReport) aContext;
final FailedAssert aFailedAssert = new FailedAssert();
aFailedAssert.setFlag(aAssertReport.getFlag());
aFailedAssert.setId(aAssertReport.getID());
aFailedAssert.setLocation(_getPathToNode(aRuleMatchingNode));
// TODO role
aFailedAssert.setTest(sTestExpression);
aFailedAssert.setText(_getErrorText(aBoundAssertReport.getAllBoundContentElements(), aRuleMatchingNode));
_handleDiagnosticReferences(aAssertReport.getAllDiagnostics(), aFailedAssert.getDiagnosticReference(), aBoundAssertReport, aRuleMatchingNode);
m_aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert().add(aFailedAssert);
return EContinue.CONTINUE;
}
Aggregations