Class PSXPathQueryBinding
java.lang.Object
com.helger.schematron.pure.binding.xpath.PSXPathQueryBinding
- All Implemented Interfaces:
IPSQueryBinding,Serializable
Default XPath/XSLT query binding
- Author:
- Philip Helger
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind(PSSchema aSchema, String sPhase, IPSErrorHandler aCustomErrorListener, IPSValidationHandler aCustomValidationHandler, IXPathConfig aXPathConfig) Create a bound schema, which is like a precompiled schema.static PSXPathQueryBindinggetNegatedTestExpression(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 byIPSQueryBinding.getNegatedTestExpression(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.static StringgetWithParamTextsReplacedStatic(String sText, Map<String, String> aStringReplacements) 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.binding.IPSQueryBinding
bind
-
Field Details
-
PARAM_VARIABLE_PREFIX
public static final char PARAM_VARIABLE_PREFIX- See Also:
-
-
Constructor Details
-
PSXPathQueryBinding
protected PSXPathQueryBinding()
-
-
Method Details
-
getInstance
-
getNegatedTestExpression
Description copied from interface:IPSQueryBindingNegate the passed test statement. This is required in the creation of a minified Schematron, when report elements are converted to assert elements.- Specified by:
getNegatedTestExpressionin interfaceIPSQueryBinding- Parameters:
sTest- The test expression.- Returns:
- The negated test expression
-
getStringReplacementMap
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsNavigableMap<String,String> getStringReplacementMap(@Nonnull List<PSParam> aParams) Description copied from interface:IPSQueryBindingConvert 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.- Specified by:
getStringReplacementMapin interfaceIPSQueryBinding- Parameters:
aParams- Source list. May not benull.- Returns:
- Non-
nullString replacement map.
-
getWithParamTextsReplacedStatic
-
getWithParamTextsReplaced
@Nullable public String getWithParamTextsReplaced(@Nullable String sText, @Nullable Map<String, String> aStringReplacements) Description copied from interface:IPSQueryBindingApply the Map created byIPSQueryBinding.getNegatedTestExpression(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
- Specified by:
getWithParamTextsReplacedin interfaceIPSQueryBinding- 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 public IPSBoundSchema bind(@Nonnull PSSchema aSchema, @Nullable String sPhase, @Nullable IPSErrorHandler aCustomErrorListener, @Nullable IPSValidationHandler aCustomValidationHandler, @Nullable IXPathConfig aXPathConfig) throws com.helger.schematron.SchematronException Description copied from interface:IPSQueryBindingCreate a bound schema, which is like a precompiled schema.- Specified by:
bindin interfaceIPSQueryBinding- 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.aCustomErrorListener- 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
-
toString
-