Class LoggingPSValidationHandler
java.lang.Object
com.helger.schematron.pure.validation.LoggingPSValidationHandler
- All Implemented Interfaces:
IPSValidationHandler
A logging implementation of
IPSValidationHandler- Since:
- 5.3.0
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.LoggingPSValidationHandler(org.slf4j.Logger aLogger) Constructor with a custom logger -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetAsString(Node aNode) static StringgetAsString(NodeList aNL) final org.slf4j.Loggerfinal com.helger.commons.error.level.IErrorLevelfinal StringvoidThis is the last method called.com.helger.commons.state.EContinueonFailedAssert(PSAssertReport aAssertReport, String sTestExpression, Node aRuleMatchingNode, int nNodeIndex, Object aContext) This method is called for every failed assert.voidonFiredRule(PSRule aRule, String sContext, int nNodeIndex, int nNodeCount) This method is called for every rule inside the current pattern.voidThis method is called for every pattern inside the schema.voidonRuleStart(PSRule aRule, NodeList aContextList) Called once for each rule, even if the context list is empty.voidThis is the first method called.com.helger.commons.state.EContinueonSuccessfulReport(PSAssertReport aAssertReport, String sTestExpression, Node aRuleMatchingNode, int nNodeIndex, Object aContext) This method is called for every failed assert.setLogLevel(com.helger.commons.error.level.IErrorLevel aLogLevel) setLogPrefix(String sLogPrefix) 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
-
Constructor Details
-
LoggingPSValidationHandler
public LoggingPSValidationHandler()Default constructor. -
LoggingPSValidationHandler
Constructor with a custom logger- Parameters:
aLogger- The logger to use. May not benull.
-
-
Method Details
-
getLogger
-
getLogLevel
-
setLogLevel
@Nonnull public final LoggingPSValidationHandler setLogLevel(@Nonnull com.helger.commons.error.level.IErrorLevel aLogLevel) -
getLogPrefix
-
setLogPrefix
-
getAsString
-
getAsString
-
onStart
public void onStart(@Nonnull PSSchema aSchema, @Nullable PSPhase aActivePhase, @Nullable String sBaseURI) throws SchematronValidationException Description copied from interface:IPSValidationHandlerThis is the first method called.- Specified by:
onStartin interfaceIPSValidationHandler- Parameters:
aSchema- The Schematron to be validated. Nevernull.aActivePhase- The selected phase, if any special phase was selected. May benull.sBaseURI- The Base URI of the XML to be validated. May benull.- Throws:
SchematronValidationException- In case of validation errors- See Also:
-
onPattern
Description copied from interface:IPSValidationHandlerThis method is called for every pattern inside the schema.- Specified by:
onPatternin interfaceIPSValidationHandler- Parameters:
aPattern- The current pattern. Nevernull.- Throws:
SchematronValidationException- In case of validation errors
-
onRuleStart
public void onRuleStart(@Nonnull PSRule aRule, @Nonnull NodeList aContextList) throws SchematronValidationException Description copied from interface:IPSValidationHandlerCalled once for each rule, even if the context list is empty.- Specified by:
onRuleStartin interfaceIPSValidationHandler- Parameters:
aRule- The rule that is to be executed.aContextList- The list of context nodes. Nevernullbut maybe empty.- Throws:
SchematronValidationException- In case of errors
-
onFiredRule
public void onFiredRule(@Nonnull PSRule aRule, @Nonnull String sContext, @Nonnegative int nNodeIndex, @Nonnegative int nNodeCount) throws SchematronValidationException Description copied from interface:IPSValidationHandlerThis method is called for every rule inside the current pattern. Was called "onRule" previously.- Specified by:
onFiredRulein interfaceIPSValidationHandler- Parameters:
aRule- The current rule. Nevernull.sContext- The real context to be used in validation. May differ from the result ofPSRule.getContext()because of replaced variables from <let> elements.nNodeIndex- 0-based node index currently firednNodeCount- The total number of nodes for this rule. Always > 0.- Throws:
SchematronValidationException- In case of validation errors
-
onFailedAssert
@Nonnull public com.helger.commons.state.EContinue onFailedAssert(@Nonnull PSAssertReport aAssertReport, @Nonnull String sTestExpression, @Nonnull Node aRuleMatchingNode, int nNodeIndex, @Nullable Object aContext) throws SchematronValidationException 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.- Throws:
SchematronValidationException- In case of validation errors
-
onSuccessfulReport
@Nonnull public com.helger.commons.state.EContinue onSuccessfulReport(@Nonnull PSAssertReport aAssertReport, @Nonnull String sTestExpression, @Nonnull Node aRuleMatchingNode, int nNodeIndex, @Nullable Object aContext) throws SchematronValidationException 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.- Throws:
SchematronValidationException- In case of validation errors
-
onEnd
public void onEnd(@Nonnull PSSchema aSchema, @Nullable PSPhase aActivePhase) throws SchematronValidationException Description copied from interface:IPSValidationHandlerThis is the last method called. It indicates that the validation for the current scheme ended.- Specified by:
onEndin interfaceIPSValidationHandler- Parameters:
aSchema- The Schematron that was be validated. Nevernull.aActivePhase- The selected phase, if any special phase was selected. May benull.- Throws:
SchematronValidationException- In case of validation errors- See Also:
-
toString
-