Class PSXPathQueryBinding

java.lang.Object
com.helger.schematron.pure.binding.xpath.PSXPathQueryBinding
All Implemented Interfaces:
IPSQueryBinding, Serializable

public class PSXPathQueryBinding extends Object implements IPSQueryBinding
Default XPath/XSLT query binding
Author:
Philip Helger
See Also:
  • Field Details

  • Constructor Details

    • PSXPathQueryBinding

      protected PSXPathQueryBinding()
  • Method Details

    • getInstance

      @Nonnull public static PSXPathQueryBinding getInstance()
    • getNegatedTestExpression

      @Nonnull public String getNegatedTestExpression(@Nonnull String sTest)
      Description copied from interface: IPSQueryBinding
      Negate the passed test statement. This is required in the creation of a minified Schematron, when report elements are converted to assert elements.
      Specified by:
      getNegatedTestExpression in interface IPSQueryBinding
      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: IPSQueryBinding
      Convert the passed list of PSParam elements 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:
      getStringReplacementMap in interface IPSQueryBinding
      Parameters:
      aParams - Source list. May not be null.
      Returns:
      Non-null String replacement map.
    • getWithParamTextsReplacedStatic

      @Nullable public static String getWithParamTextsReplacedStatic(@Nullable String sText, @Nullable Map<String,String> aStringReplacements)
    • getWithParamTextsReplaced

      @Nullable public String getWithParamTextsReplaced(@Nullable String sText, @Nullable Map<String,String> aStringReplacements)
      Description copied from interface: IPSQueryBinding
      Apply the Map created by IPSQueryBinding.getNegatedTestExpression(String) on a single string.
      According to iso_abstract_expand.xsl, line 233 the text replacements happen for the following attributes: As an experimental option in line 244 the replacement is also applied to all text nodes. This is currently not supported!
      Specified by:
      getWithParamTextsReplaced in interface IPSQueryBinding
      Parameters:
      sText - The original text. May be null.
      aStringReplacements - All replacements as map from source to target. The map should be ordered by longest keys first.
      Returns:
      null if the input string was null.
    • 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: IPSQueryBinding
      Create a bound schema, which is like a precompiled schema.
      Specified by:
      bind in interface IPSQueryBinding
      Parameters:
      aSchema - The schema to be bound. May not be null.
      sPhase - The phase to use. May be null. If it is null than 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 be null.
      aCustomValidationHandler - A custom PS validation handler to use. May be null.
      aXPathConfig - The XPath configuration to be used. May be null.
      Returns:
      The bound schema and never null.
      Throws:
      com.helger.schematron.SchematronException - In case of a binding error
    • toString

      public String toString()
      Overrides:
      toString in class Object