Package com.saxonica.ee.schema.sdoc

## 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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.sf.saxon.expr.parser.XPathParser

      `XPathParser.Accelerator, XPathParser.NestedLocation, XPathParser.ParsedLanguage`

  - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.expr.parser.XPathParser

      `allowSaxonExtensions, allowXPath30Syntax, allowXPath30XSLTExtensions, allowXPath31Syntax, catchDepth, charChecker, codeInjector, env, language, languageVersion, parserExtension, qNameParser, rangeVariables, scanOnly, t`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SelectionParser()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Expression` | `getOptimizedExpression()` | After parsing a selector, return the optimized version of the XPath expression that was parsed
    `protected Expression` | `parseRelativePath()` | Parse a relative path (a sequence of steps).
    `Pattern` | `parseSelector​(java.lang.String expression, StaticContext env, boolean isField)` | Parse a string representing the restricted XPath expression allowed in an XML Schema selector or field attribute
    `protected Expression` | `parseStepExpression()` | Override the general XPath parsing of a StepExpression to support the simpler kind of Step used in XML Schema selectors
    `protected Expression` | `parseUnionExpression()` |

    - ### Methods inherited from class net.sf.saxon.expr.parser.XPathParser

      `atStartOfRelativePath, checkLanguageVersion30, checkLanguageVersion31, checkMapExtensions, checkSyntaxExtensions, currentTokenDisplay, customizeTokenizer, declareRangeVariable, disallowedAtStartOfRelativePath, expect, findRangeVariable, generateApplyCall, getCodeInjector, getLanguage, getMissingFunctionExplanation, getPlainType, getQNameParser, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isAllowAbsentExpression, isAllowXPath31Syntax, isKeyword, isNamespaceTestAllowed, isReservedFunctionName30, isReservedFunctionName31, isReservedInQuery, makeCurriedFunction, makeFingerprint, makeLocalNameTest, makeLocation, makeLocation, makeNamespaceTest, makeNameTest, makeNestedLocation, makeNodeName, makeQNameTest, makeStringLiteral, makeStructuredQName, makeStructuredQNameSilently, makeTracer, nextToken, operatorPrecedence, parse, parseAnnotationsList, parseArrayCurlyConstructor, parseArrayItemType, parseArraySquareConstructor, parseArrowPostfix, parseBackTickedStringLiteral, parseBasicStep, parseBinaryExpression, parseConstructor, parseDynamicFunctionCall, parseExpression, parseExprSingle, parseExtendedItemType, parseExtendedSequenceType, parseExtensionExpression, parseFLWORExpression, parseFunctionArgument, parseFunctionCall, parseFunctionItemType, parseInlineFunction, parseItemType, parseLookup, parseMapExpression, parseMapItemType, parseNamedFunctionReference, parseNodeTest, parseNumericLiteral, parseParenthesizedExpression, parsePathExpression, parsePredicate, parsePredicate, parseRemainingPath, parseSequenceType, parseSequenceType, parseSimpleMappingExpression, parseStepExpression, parseStringConstructor, parseStringLiteral, parseSwitchExpression, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, reportMissingFunction, resolveFunctionName, setAccelerator, setAllowAbsentExpression, setCatchDepth, setCodeInjector, setLanguage, setLocation, setLocation, setLocation, setParserExtension, setQNameParser, setRangeVariables, setRangeVariableStack, setScanOnly, testPermittedAxis, undeclareRangeVariable, unescape, warning, whyDisallowedType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SelectionParser

          public SelectionParser()

  - ### 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
      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

          protected Expression parseUnionExpression()
                                             throws XPathException

      Throws:
        `XPathException`

    - #### 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)
      Overrides:
        `parseRelativePath` in class `XPathParser`
      Returns:
        the resulting subexpression
      Throws:
        `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
      Returns:
        an Expression, which will always be either an AxisExpression or a ContextItemExpression
      Throws:
        `XPathException` - if parsing fails

    - #### getOptimizedExpression

          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