Class PSXPathBoundSchema
java.lang.Object
com.helger.schematron.pure.bound.AbstractPSBoundSchema
com.helger.schematron.pure.bound.xpath.PSXPathBoundSchema
- All Implemented Interfaces:
IPSBoundSchema
The default XPath binding for the pure Schematron implementation.
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionPSXPathBoundSchema(IPSQueryBinding aQueryBinding, PSSchema aOrigSchema, String sPhase, IPSErrorHandler aCustomErrorListener, IPSValidationHandler aCustomValidationHandler, IXPathConfig aXPathConfig) Create a new bound schema. -
Method Summary
Modifier and TypeMethodDescriptionbind()getValidationContext(String sRuleContext) Get the validation context to be used.booleanvoidsetUseParallel(boolean b) toString()voidvalidate(Node aNode, String sBaseURI, IPSValidationHandler aValidationHandler) The generic validation method.Methods inherited from class com.helger.schematron.pure.bound.AbstractPSBoundSchema
createPartialValidationHandler, error, error, getAllRelevantPatterns, getCustomValidationHandler, getErrorHandler, getNamespaceContext, getOriginalSchema, getPhase, getPhaseID, getQueryBinding, isDefaultErrorHandler, isPhaseSpecified, validateComplete, validatePartially, warn
-
Constructor Details
-
PSXPathBoundSchema
public PSXPathBoundSchema(@Nonnull IPSQueryBinding aQueryBinding, @Nonnull PSSchema aOrigSchema, @Nullable String sPhase, @Nullable IPSErrorHandler aCustomErrorListener, @Nullable IPSValidationHandler aCustomValidationHandler, @Nullable IXPathConfig aXPathConfig) throws SchematronBindException Create a new bound schema. All the XPath pre-compilation happens inside this constructor, so that thevalidate(Node, String, IPSValidationHandler)method can be called many times without compiling the XPath statements again and again.- Parameters:
aQueryBinding- The query binding to be used. May not benull.aOrigSchema- The original schema that should be bound. May not benull.sPhase- The selected phase. May benullindicating that the default phase of the schema should be used (if present) or all patterns should be evaluated if no default phase is present.aCustomErrorListener- A custom error listener to be used. May benullin which case aLoggingPSErrorHandleris used internally.aCustomValidationHandler- The custom PS validation handler. May benull.aXPathConfig- The XPath configuration to be used. May benull.- Throws:
SchematronBindException- In case XPath expressions are incorrect and pre-compilation fails
-
-
Method Details
-
isUseParallel
public boolean isUseParallel() -
setUseParallel
public void setUseParallel(boolean b) -
bind
- Throws:
SchematronBindException
-
getXPathVariableResolver
-
getXPathFunctionResolver
-
getValidationContext
Description copied from interface:IPSBoundSchemaGet the validation context to be used. As rules can be stated as "element" they are not necessarily present on root level. For XPath this may e.g. be resolved by prepending "//" so that all elements are resolved correctly.- Parameters:
sRuleContext- The original rule context. May not benull.- Returns:
- The real validation context to use.
-
validate
public void validate(@Nonnull Node aNode, @Nullable String sBaseURI, @Nonnull IPSValidationHandler aValidationHandler) throws SchematronValidationException Description copied from interface:IPSBoundSchemaThe generic validation method. It validates the passed XML node to this bound schema.- Parameters:
aNode- The node to be validated. May not benull.sBaseURI- Base URI of the XML to be validated. May benull.aValidationHandler- The validation handler that receives the callback informations. May not benull.- Throws:
SchematronValidationException- In case a validation exception occurs
-
toString
- Overrides:
toStringin classAbstractPSBoundSchema
-