Class SelectionParser

java.lang.Object
net.sf.saxon.expr.parser.XPathParser
com.saxonica.ee.schema.sdoc.SelectionParser

public class SelectionParser extends XPathParser
This class parses the two XPath subsets defined in XML Schema for handling the "selector" and "field" attributes of the <unique>, <key>, and <keyref> elements.
  • Constructor Details Link icon

  • Method Details Link icon

    • parseSelector Link icon

      public Pattern parseSelector(String expression, StaticContext env, boolean isField) throws XPathException
      Parse a string representing the restricted XPath expression allowed in an XML Schema selector or field attribute
      Parameters:
      expression - the expression expressed as a String
      env - the static context for the expression
      isField - true if the attribute is a "field" attribute, false if it is a "selector" attribute
      Returns:
      a Pattern object representing the result of parsing. The expression equivalent to this pattern may be obtained by calling getOptimizedExpression().
      Throws:
      XPathException - if the expression contains a syntax error
    • parseUnionExpression Link icon

      protected Expression parseUnionExpression() throws XPathException
      Throws:
      XPathException
    • parseRelativePath Link icon

      protected Expression parseRelativePath() throws XPathException
      Description copied from class: XPathParser
      Parse a relative path (a sequence of steps). Called when the current token immediately follows a separator (/ or //), or an implicit separator (XYZ is equivalent to ./XYZ)
      Overrides:
      parseRelativePath in class XPathParser
      Returns:
      the resulting subexpression
      Throws:
      XPathException - if any error is encountered
    • parseStepExpression Link icon

      protected Expression parseStepExpression() throws XPathException
      Override the general XPath parsing of a StepExpression to support the simpler kind of Step used in XML Schema selectors
      Returns:
      an Expression, which will always be either an AxisExpression or a ContextItemExpression
      Throws:
      XPathException - if parsing fails
    • getOptimizedExpression Link icon

      public Expression getOptimizedExpression()
      After parsing a selector, return the optimized version of the XPath expression that was parsed
      Returns:
      the optimized XPath expression equivalent to the pattern that was created by parsing the selector