com.saxonica.sdoc
Class SelectionParser
java.lang.Object
net.sf.saxon.expr.ExpressionParser
com.saxonica.sdoc.SelectionParser
public class SelectionParser
- extends ExpressionParser
This class parses the two XPath subsets defined in XML Schema for handling
the "selector" and "field" attributes of the , , and
elements.
Fields inherited from class net.sf.saxon.expr.ExpressionParser |
compileWithTracing, defaultContainer, env, language, nameChecker, rangeVariables, scanOnly, SEQUENCE_TYPE, t, XPATH, XQUERY, XSLT_PATTERN |
Methods inherited from class net.sf.saxon.expr.ExpressionParser |
currentTokenDisplay, declareRangeVariable, expect, findRangeVariable, getLanguage, getRangeVariableStack, getTokenizer, grumble, grumble, grumble, isCompileWithTracing, isKeyword, isNamespaceTestAllowed, makeLocalNameTest, makeNameCode, makeNameCodeSilently, makeNamespaceTest, makeNameTest, makeStringLiteral, makeStructuredQName, makeTracer, nextToken, parse, parseConstructor, parseDynamicFunctionCall, parseExpression, parseExprSingle, parseExtensionExpression, parseForExpression, parseFunctionCall, parseFunctionItemType, parseInlineFunction, parseItemType, parseLiteralFunctionItem, parseMappingExpression, parseNodeTest, parseParenthesizedItemType, parsePattern, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, setCompileWithTracing, setLocation, setLocation, setRangeVariableStack, setScanOnly, undeclareRangeVariable, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SelectionParser
public SelectionParser()
parseSelector
public Selection 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 Stringenv
- the static context for the expressionisField
- true if the attribute is a "field" attribute, false if
it is a "selector" attribute
- Returns:
- an Expression object representing the result of parsing
- Throws:
XPathException
- if the expression contains a syntax error
makePathSelection
public static PathSelection makePathSelection(Expression path,
List reasonForFailure)
throws XPathException
- Make a PathSelection object from a suitable expression. This method is public because it is also
used by the optimizer for SequentialCopy expressions.
- Parameters:
path
- the input expressionreasonForFailure
- if true, supplied, and the expression is unsuitable, the method will add a string
to the list explaining why it was unsuitable. If the parameter is null, an exception will be thrown if the
expression is unsuitable.
- Returns:
- The PathSelection object, or null if the expression is unsuitable for use as a PathSelection
and the failIfInvalid argument was set to false.
- Throws:
XPathException
- if the expression is unsuitable for use as a PathSelection
and the failIfInvalid argument was set to true.
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
- Overrides:
parseStepExpression
in class ExpressionParser
- Returns:
- an Expression, which will always be either an AxisExpression or a
ContextItemExpression
- Throws:
XPathException
Copyright (c) Saxonica Limited. All rights reserved.