Interface IPSQueryBinding
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
PSXPathQueryBinding
Base interface for a single query binding.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptiondefault IPSBoundSchemabind(PSSchema aSchema, String sPhase, IPSErrorHandler aCustomErrorHandler, IPSValidationHandler aCustomValidationHandler, IXPathConfig aXPathConfig) Create a bound schema, which is like a precompiled schema.getNegatedTestExpression(String sTest) Negate the passed test statement.getStringReplacementMap(List<PSParam> aParams) Convert the passed list ofPSParamelements to a map suitable for String replacement.getWithParamTextsReplaced(String sText, Map<String, String> aStringReplacements) Apply the Map created bygetNegatedTestExpression(String)on a single string.
According to iso_abstract_expand.xsl, line 233 the text replacements happen for the following attributes: test - only inPSAssertReportcontext - only inPSRuleselect - only inPSValueOfAs an experimental option in line 244 the replacement is also applied to all text nodes.
-
Method Details
-
getNegatedTestExpression
Negate the passed test statement. This is required in the creation of a minified Schematron, when report elements are converted to assert elements.- Parameters:
sTest- The test expression.- Returns:
- The negated test expression
-
getStringReplacementMap
@Nonnull @ReturnsMutableCopy com.helger.commons.collection.impl.ICommonsNavigableMap<String,String> getStringReplacementMap(@Nonnull List<PSParam> aParams) Convert the passed list ofPSParamelements to a map suitable for String replacement. This is needed to resolve placeholders in abstract patterns. The default query binding e.g. adds a "$" in front of each parameter name. The so created map is used to resolve abstract rule and pattern data to real values.- Parameters:
aParams- Source list. May not benull.- Returns:
- Non-
nullString replacement map.
-
getWithParamTextsReplaced
@Nullable String getWithParamTextsReplaced(@Nullable String sText, @Nullable Map<String, String> aStringReplacements) Apply the Map created bygetNegatedTestExpression(String)on a single string.
According to iso_abstract_expand.xsl, line 233 the text replacements happen for the following attributes:- test - only in
PSAssertReport - context - only in
PSRule - select - only in
PSValueOf
- Parameters:
sText- The original text. May benull.aStringReplacements- All replacements as map from source to target. The map should be ordered by longest keys first.- Returns:
nullif the input string wasnull.
- test - only in
-
bind
@Nonnull default IPSBoundSchema bind(@Nonnull PSSchema aSchema) throws com.helger.schematron.SchematronException - Throws:
com.helger.schematron.SchematronException
-
bind
@Nonnull IPSBoundSchema bind(@Nonnull PSSchema aSchema, @Nullable String sPhase, @Nullable IPSErrorHandler aCustomErrorHandler, @Nullable IPSValidationHandler aCustomValidationHandler, @Nullable IXPathConfig aXPathConfig) throws com.helger.schematron.SchematronException Create a bound schema, which is like a precompiled schema.- Parameters:
aSchema- The schema to be bound. May not benull.sPhase- The phase to use. May benull. If it isnullthan the defaultPhase is used that is defined in the schema. If no defaultPhase is present, than all patterns are evaluated.aCustomErrorHandler- An optional custom error handler to use. May benull.aCustomValidationHandler- A custom PS validation handler to use. May benull.aXPathConfig- The XPath configuration to be used. May benull.- Returns:
- The bound schema and never
null. - Throws:
com.helger.schematron.SchematronException- In case of a binding error- Since:
- 5.5.0
-