Class 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 Detail

    • Method Detail

      • parseSelector

        public Pattern parseSelector​(java.lang.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
        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
        a Pattern object representing the result of parsing. The expression equivalent to this pattern may be obtained by calling getOptimizedExpression().
        XPathException - if the expression contains a syntax error
      • parseRelativePath

        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)
        parseRelativePath in class XPathParser
        the resulting subexpression
        XPathException - if any error is encountered
      • parseStepExpression

        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
        an Expression, which will always be either an AxisExpression or a ContextItemExpression
        XPathException - if parsing fails
      • getOptimizedExpression

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