Class PSValidationHandlerBreakOnFirstFailedAssert

java.lang.Object
com.helger.schematron.pure.validation.PSValidationHandlerBreakOnFirstFailedAssert
All Implemented Interfaces:
IPSPartialValidationHandler, IPSValidationHandler

@NotThreadSafe public class PSValidationHandlerBreakOnFirstFailedAssert extends Object implements IPSPartialValidationHandler
A simple implementation if IPSValidationHandler that stops validation upon the first failed assertion. The final validation result can be retrieved by invoking getValidity().
Author:
Philip Helger
  • Constructor Details

    • PSValidationHandlerBreakOnFirstFailedAssert

      public PSValidationHandlerBreakOnFirstFailedAssert()
  • 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: IPSValidationHandler
      This method is called for every failed assert.
      Specified by:
      onFailedAssert in interface IPSValidationHandler
      Parameters:
      aAssertReport - The current assert element. Never null.
      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. Never null.
      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. an PSXPathBoundAssertReport object.
      Returns:
      EContinue.BREAK to stop validating immediately.
    • getValidity

      @Nonnull public com.helger.commons.state.EValidity getValidity()
      Specified by:
      getValidity in interface IPSPartialValidationHandler
      Returns:
      The validity of the XML file. EValidity.VALID if no failed assertion and no successful report occurred, EValidity.INVALID otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object