Class PSValidationHandlerBreakOnFirstError
java.lang.Object
com.helger.schematron.pure.validation.PSValidationHandlerBreakOnFirstError
- All Implemented Interfaces:
IPSPartialValidationHandler,IPSValidationHandler
@NotThreadSafe
public class PSValidationHandlerBreakOnFirstError
extends Object
implements IPSPartialValidationHandler
A simple implementation if
IPSValidationHandler that stops validation
upon the first error (the first failed assert or the first successful
report). The final validation result can be retrieved by invoking
getValidity().- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal com.helger.commons.state.EValiditycom.helger.commons.state.EContinueonFailedAssert(PSAssertReport aAssertReport, String sTestExpression, Node aRuleMatchingNode, int nNodeIndex, Object aContext) This method is called for every failed assert.com.helger.commons.state.EContinueonSuccessfulReport(PSAssertReport aAssertReport, String sTestExpression, Node aRuleMatchingNode, int nNodeIndex, Object aContext) This method is called for every failed assert.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.schematron.pure.validation.IPSValidationHandler
and, onEnd, onFiredRule, onPattern, onRuleStart, onStart
-
Constructor Details
-
PSValidationHandlerBreakOnFirstError
public PSValidationHandlerBreakOnFirstError()
-
-
Method Details
-
onFailedAssert
@Nonnull public com.helger.commons.state.EContinue onFailedAssert(@Nonnull PSAssertReport aAssertReport, @Nonnull String sTestExpression, @Nonnull Node aRuleMatchingNode, int nNodeIndex, @Nullable Object aContext) Description copied from interface:IPSValidationHandlerThis method is called for every failed assert.- Specified by:
onFailedAssertin interfaceIPSValidationHandler- Parameters:
aAssertReport- The current assert element. Nevernull.sTestExpression- The source XPath expression that was evaluated for this node. It may be different from the test expression contained in the passed assert/report element because of replaced <let> elements. Nevernull.aRuleMatchingNode- The XML node of the document to be validated.nNodeIndex- The index of the matched node, relative to the current rule.aContext- A context object - implementation dependent. For the default query binding this is e.g. anPSXPathBoundAssertReportobject.- Returns:
EContinue.BREAKto stop validating immediately.
-
onSuccessfulReport
@Nonnull public com.helger.commons.state.EContinue onSuccessfulReport(@Nonnull PSAssertReport aAssertReport, @Nonnull String sTestExpression, @Nonnull Node aRuleMatchingNode, int nNodeIndex, @Nullable Object aContext) Description copied from interface:IPSValidationHandlerThis method is called for every failed assert.- Specified by:
onSuccessfulReportin interfaceIPSValidationHandler- Parameters:
aAssertReport- The current assert element. Nevernull.sTestExpression- The source XPath expression that was evaluated for this node. It may be different from the test expression contained in the passed assert/report element because of replaced <let> elements. Nevernull.aRuleMatchingNode- The XML node of the document to be validated.nNodeIndex- The index of the matched node, relative to the current rule.aContext- A context object - implementation dependent. For the default query binding this is e.g. anPSXPathBoundAssertReportobject.- Returns:
EContinue.BREAKto stop validating immediately.
-
getValidity
- Specified by:
getValidityin interfaceIPSPartialValidationHandler- Returns:
- The validity of the XML file.
EValidity.VALIDif no failed assertion and no successful report occurred,EValidity.INVALIDotherwise.
-
toString
-