use of com.helger.schematron.pure.bound.xpath.PSXPathBoundAssertReport in project ph-schematron by phax.
the class PSXPathValidationHandlerSVRL method onSuccessfulReport.
@Override
@Nonnull
public EContinue onSuccessfulReport(@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 SuccessfulReport aSuccessfulReport = new SuccessfulReport();
aSuccessfulReport.setFlag(aAssertReport.getFlag());
aSuccessfulReport.setId(aAssertReport.getID());
aSuccessfulReport.setLocation(_getPathToNode(aRuleMatchingNode));
// TODO role
aSuccessfulReport.setTest(sTestExpression);
aSuccessfulReport.setText(_getErrorText(aBoundAssertReport.getAllBoundContentElements(), aRuleMatchingNode));
_handleDiagnosticReferences(aAssertReport.getAllDiagnostics(), aSuccessfulReport.getDiagnosticReference(), aBoundAssertReport, aRuleMatchingNode);
m_aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert().add(aSuccessfulReport);
return EContinue.CONTINUE;
}
use of com.helger.schematron.pure.bound.xpath.PSXPathBoundAssertReport 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