| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| private int | |
| protected static final int | FILTER_MATCH_FAILED
Results from checking FilterExpr syntax |
| protected static final int | |
| protected static final int | |
| pack-priv boolean | |
| pack-priv boolean | |
| private ErrorListener | m_errorListener
The error listener where syntax errors are to be sent. |
| private FunctionTable | m_functionTable
The table contains build-in functions and customized functions |
| pack-priv PrefixResolver | m_namespaceContext
The prefix resolver to map prefixes to namespaces in the OpMap. |
| private OpMap | m_ops
The XPath to be processed. |
| pack-priv int | m_queueMark
The position in the token queue is tracked by m_queueMark. |
| pack-priv SourceLocator | m_sourceLocator
The source location of the XPath. |
| pack-priv transient String | m_token
The next token in the pattern. |
| pack-priv transient char | m_tokenChar
The first char in m_token, the theory being that this is an optimization because we won't have to do charAt(0) as often. |
| pack-priv XMLSecurityManager | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | XPathParser(ErrorListener errorListener, SourceLocator sourceLocator, XMLSecurityManager xmlSecMgr)
The parser constructor. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: boolean indicating whether a slash following the step was consumeda boolean indicating whether a slash can
appear at the start of this step isLeadingSlashPermitted)AbbreviatedNodeTestStep ::= '@'? |
| protected int | Returns: the position at the end of the equality expression.Position where expression is to be added, or -1 for append. addPos)This has to handle construction of the operations so that they are evaluated in pre-fix order. |
| protected void | |
| pack-priv void | appendOp(int
The length of the operation. length, int The op code to the inserted. op)Insert room for operation. |
| protected void | |
| private void | |
| protected int | Returns: FROM_XXX axes type, found incom..Basis ::= AxisName '::' NodeTest | AbbreviatedBasis |
| protected void | |
| protected void | |
| private void | |
| private final void | consumeExpected(char
the character to be expected. expected)Consume an expected token, throwing an exception if it isn't there. |
| protected String | Returns: A dump of the remaining token queue, which may be appended to an error message.Dump the remaining token queue. |
| protected int | Returns: the position at the end of the equality expression.Position where expression is to be added, or -1 for append. addPos)returns an Object which is either a String, a Number, a Boolean, or a vector of nodes. |
| pack-priv void | error(String
An error msgkey that corresponds to one of the constants found
in msg, Object[] com., which is
a key for a format string.An array of arguments represented in the format string, which
may be null. args)Notify the user of an error, and probably throw an exception. |
| protected void | |
| protected int | Returns: FILTER_MATCH_PREDICATES, if this method successfully matched a FilterExpr with one or more Predicates; FILTER_MATCH_PRIMARY, if this method successfully matched a FilterExpr that was just a PrimaryExpr; or FILTER_MATCH_FAILED, if this method did not match a FilterExprFilterExpr ::= PrimaryExpr | FilterExpr Predicate |
| protected boolean | Returns: true if, and only if, a FunctionCall was matchedFunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? |
| public ErrorListener | Returns: The error listener, which should not normally be null, but may be.Return the current error listener. |
| pack-priv final int | Returns: The function ID, which may correspond to one of the FUNC_XXX values found incom., but may
be a value installed by an external module.A local name of a function. key)Given a string, return the corresponding function token. |
| private final String | Returns: The string at the given index, or null if the index is out of range.Position relative to current token. i)Retrieve a token relative to the current token. |
| protected void | IdKeyPattern()
IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc()) |
| public void | initMatchPattern(Compiler
The XPath object to be initialized. compiler, String A String representing the XPath. expression, PrefixResolver An object that is able to resolve prefixes in
the XPath to namespaces. namespaceContext)Given an string, init an XPath object for pattern matches, in order that a parse doesn't have to be done each time the expression is evaluated. |
| public void | initXPath(Compiler
The compiler object. compiler, String A string conforming to the XPath grammar. expression, PrefixResolver An object that is able to resolve prefixes in
the XPath to namespaces. namespaceContext)Given an string, init an XPath object for selections, in order that a parse doesn't have to be done each time the expression is evaluated. |
| pack-priv void | insertOp(int
The position where the op is to be inserted. pos, int The length of the operation space in the op map. length, int The op code to the inserted. op)Insert room for operation. |
| private boolean | Returns: true if the function token represents a function that returns a nodeset, false otherwisethe function token funcTok)Checks whether the function token represents a function that returns a nodeset. |
| protected void | |
| protected void | |
| protected void | |
| pack-priv final boolean | Returns: true if the next token matches the character argument.the character to be tested for. c, int number of tokens to look ahead. Must be
greater than 1. n)Look ahead of the current token in order to make a branching decision. |
| private final boolean | |
| private final boolean | Returns: true if the token behind the current token matches the character argument.the character to compare it to. c, int number of tokens to look behind. Must be
greater than 1. Note that the look behind terminates
at either the beginning of the string or on a '|'
character. Because of this, this method should only
be used for pattern matching. n)Look behind the first character of the current token in order to make a branching decision. |
| private final boolean | Returns: true if look behind has a token, false otherwise.number of tokens to look behind. Must be
greater than 1. Note that the look behind terminates
at either the beginning of the string or on a '|'
character. Because of this, this method should only
be used for pattern matching. n)look behind the current token in order to see if there is a useable token. |
| protected int | Returns: the position at the end of the equality expression.Position where expression is to be added, or -1 for append. addPos)This has to handle construction of the operations so that they are evaluated in pre-fix order. |
| protected void | NCName()
NCName ::= (Letter | '_') (NCNameChar) NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender |
| private final void | |
| protected void | NodeTest(int
FROM_XXX axes type, found in axesType)com..NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' |
| protected void | |
| protected void | |
| protected void | |
| protected void | PathExpr()
PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath |
| protected void | |
| protected void | |
| protected void | |
| private final void | |
| protected boolean | Returns: true if this method successfully matched a PrimaryExprPrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall |
| protected void | |
| protected int | Returns: the position at the end of the relational expression.Position where expression is to be added, or -1 for append. addPos). |
| protected boolean | Returns: true if, and only if, a RelativeLocationPath was matchedRelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath |
| protected void | RelativePathPattern()
RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern |
| public void | setErrorHandler(ErrorListener
Reference to error listener where syntax errors will be
sent. handler)Allow an application to register an error event handler, where syntax errors will be sent. |
| protected boolean | Returns: false if step was empty (or only a '/'); true, otherwiseStep ::= Basis Predicate | AbbreviatedStep |
| protected boolean | Returns: boolean indicating whether a slash following the step was consumeda boolean indicating whether a slash can
appear at the start of this step isLeadingSlashPermitted)StepPattern ::= AbbreviatedNodeTestStep |
| protected void | |
| pack-priv final boolean | |
| pack-priv final boolean | Returns: If m_token is null, returns false, or return true if c matches the current token.A character to be tested. c)Check whether m_tokenChar==c. |
| protected void | |
| protected void | UnionExpr()
The context of the right hand side expressions is the context of the left hand side expression. |
| pack-priv void | warn(String
An error msgkey that corresponds to one of the constants found
in msg, Object[] com., which is
a key for a format string.An array of arguments represented in the format string, which
may be null. args)Warn the user of a problem. |
| CONTINUE_AFTER_FATAL_ERROR | back to summary |
|---|---|
| public static final String CONTINUE_AFTER_FATAL_ERROR | |
| countPredicate | back to summary |
|---|---|
| private int countPredicate | |
| FILTER_MATCH_FAILED | back to summary |
|---|---|
| protected static final int FILTER_MATCH_FAILED Results from checking FilterExpr syntax | |
| FILTER_MATCH_PREDICATES | back to summary |
|---|---|
| protected static final int FILTER_MATCH_PREDICATES | |
| FILTER_MATCH_PRIMARY | back to summary |
|---|---|
| protected static final int FILTER_MATCH_PRIMARY | |
| isLocationPath | back to summary |
|---|---|
| pack-priv boolean isLocationPath | |
| lPathRequired | back to summary |
|---|---|
| pack-priv boolean lPathRequired | |
| m_errorListener | back to summary |
|---|---|
| private ErrorListener m_errorListener The error listener where syntax errors are to be sent. | |
| m_functionTable | back to summary |
|---|---|
| private FunctionTable m_functionTable The table contains build-in functions and customized functions | |
| m_namespaceContext | back to summary |
|---|---|
| pack-priv PrefixResolver m_namespaceContext The prefix resolver to map prefixes to namespaces in the OpMap. | |
| m_ops | back to summary |
|---|---|
| private OpMap m_ops The XPath to be processed. | |
| m_queueMark | back to summary |
|---|---|
| pack-priv int m_queueMark The position in the token queue is tracked by m_queueMark. | |
| m_sourceLocator | back to summary |
|---|---|
| pack-priv SourceLocator m_sourceLocator The source location of the XPath. | |
| m_token | back to summary |
|---|---|
| pack-priv transient String m_token The next token in the pattern. | |
| m_tokenChar | back to summary |
|---|---|
| pack-priv transient char m_tokenChar The first char in m_token, the theory being that this is an optimization because we won't have to do charAt(0) as often. | |
| m_xmlSecMgr | back to summary |
|---|---|
| pack-priv XMLSecurityManager m_xmlSecMgr | |
| nextTokenRead | back to summary |
|---|---|
| pack-priv boolean nextTokenRead | |
| XPathParser | back to summary |
|---|---|
| public XPathParser(ErrorListener errorListener, SourceLocator sourceLocator, XMLSecurityManager xmlSecMgr) The parser constructor. | |
| AbbreviatedNodeTestStep | back to summary |
|---|---|
| protected boolean AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted) throws TransformerException AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate
| |
| AdditiveExpr | back to summary |
|---|---|
| protected int AdditiveExpr(int addPos) throws TransformerException This has to handle construction of the operations so that they are evaluated in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be evaluated as |-|+|9|7|6|. AdditiveExpr ::= MultiplicativeExpr | AdditiveExpr '+' MultiplicativeExpr | AdditiveExpr '-' MultiplicativeExpr
| |
| AndExpr | back to summary |
|---|---|
| protected void AndExpr() throws TransformerException AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr | |
| appendOp | back to summary |
|---|---|
| pack-priv void appendOp(int length, int op) Insert room for operation. This WILL set the length value of the operation, and will update the length value for the total expression.
| |
| Argument | back to summary |
|---|---|
| protected void Argument() throws TransformerException Argument ::= Expr | |
| assertion | back to summary |
|---|---|
| private void assertion(boolean b, String msg) Notify the user of an assertion error, and probably throw an exception.
| |
| AxisName | back to summary |
|---|---|
| protected int AxisName() throws TransformerException Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
| |
| Basis | back to summary |
|---|---|
| protected void Basis() throws TransformerException Basis ::= AxisName '::' NodeTest | AbbreviatedBasis | |
| BooleanExpr | back to summary |
|---|---|
| protected void BooleanExpr() throws TransformerException StringExpr ::= Expr | |
| checkNodeSet | back to summary |
|---|---|
| private void checkNodeSet() throws TransformerException Checks whether the operand is a location path, reports error if not.
| |
| consumeExpected | back to summary |
|---|---|
| private final void consumeExpected(char expected) throws TransformerException Consume an expected token, throwing an exception if it isn't there.
| |
| dumpRemainingTokenQueue | back to summary |
|---|---|
| protected String dumpRemainingTokenQueue() Dump the remaining token queue. Thanks to Craig for this.
| |
| EqualityExpr | back to summary |
|---|---|
| protected int EqualityExpr(int addPos) throws TransformerException returns an Object which is either a String, a Number, a Boolean, or a vector of nodes. EqualityExpr ::= RelationalExpr | EqualityExpr '=' RelationalExpr
| |
| error | back to summary |
|---|---|
| pack-priv void error(String msg, Object[] args) throws TransformerException Notify the user of an error, and probably throw an exception.
| |
| Expr | back to summary |
|---|---|
| protected void Expr() throws TransformerException Expr ::= OrExpr | |
| FilterExpr | back to summary |
|---|---|
| protected int FilterExpr() throws TransformerException FilterExpr ::= PrimaryExpr | FilterExpr Predicate
| |
| FunctionCall | back to summary |
|---|---|
| protected boolean FunctionCall() throws TransformerException FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'
| |
| getErrorListener | back to summary |
|---|---|
| public ErrorListener getErrorListener() Return the current error listener.
| |
| getFunctionToken | back to summary |
|---|---|
| pack-priv final int getFunctionToken(String key) Given a string, return the corresponding function token.
| |
| getTokenRelative | back to summary |
|---|---|
| private final String getTokenRelative(int i) Retrieve a token relative to the current token.
| |
| IdKeyPattern | back to summary |
|---|---|
| protected void IdKeyPattern() throws TransformerException IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc()) | |
| initMatchPattern | back to summary |
|---|---|
| public void initMatchPattern(Compiler compiler, String expression, PrefixResolver namespaceContext) throws TransformerException Given an string, init an XPath object for pattern matches, in order that a parse doesn't have to be done each time the expression is evaluated.
| |
| initXPath | back to summary |
|---|---|
| public void initXPath(Compiler compiler, String expression, PrefixResolver namespaceContext) throws TransformerException Given an string, init an XPath object for selections, in order that a parse doesn't have to be done each time the expression is evaluated.
| |
| insertOp | back to summary |
|---|---|
| pack-priv void insertOp(int pos, int length, int op) Insert room for operation. This will NOT set the length value of the operation, but will update the length value for the total expression.
| |
| isNodesetFunction | back to summary |
|---|---|
| private boolean isNodesetFunction(int funcTok) Checks whether the function token represents a function that returns a nodeset.
| |
| Literal | back to summary |
|---|---|
| protected void Literal() throws TransformerException The value of the Literal is the sequence of characters inside the " or ' characters>. Literal ::= '"' [^"]* '"' | "'" [^']* "'" | |
| LocationPath | back to summary |
|---|---|
| protected void LocationPath() throws TransformerException LocationPath ::= RelativeLocationPath | AbsoluteLocationPath | |
| LocationPathPattern | back to summary |
|---|---|
| protected void LocationPathPattern() throws TransformerException LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//') RelativePathPattern)? | '//'? RelativePathPattern | |
| lookahead | back to summary |
|---|---|
| pack-priv final boolean lookahead(char c, int n) Look ahead of the current token in order to make a branching decision.
| |
| lookahead | back to summary |
|---|---|
| private final boolean lookahead(String s, int n) Look ahead of the current token in order to make a branching decision.
| |
| lookbehind | back to summary |
|---|---|
| private final boolean lookbehind(char c, int n) Look behind the first character of the current token in order to make a branching decision.
| |
| lookbehindHasToken | back to summary |
|---|---|
| private final boolean lookbehindHasToken(int n) look behind the current token in order to see if there is a useable token.
| |
| MultiplicativeExpr | back to summary |
|---|---|
| protected int MultiplicativeExpr(int addPos) throws TransformerException This has to handle construction of the operations so that they are evaluated in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be evaluated as |-|+|9|7|6|. MultiplicativeExpr ::= UnaryExpr | MultiplicativeExpr MultiplyOperator UnaryExpr | MultiplicativeExpr 'div' UnaryExpr | MultiplicativeExpr 'mod' UnaryExpr | MultiplicativeExpr 'quo' UnaryExpr
| |
| NCName | back to summary |
|---|---|
| protected void NCName() throws TransformerException NCName ::= (Letter | '_') (NCNameChar) NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender | |
| nextToken | back to summary |
|---|---|
| private final void nextToken() throws TransformerException Retrieve the next token from the command and store it in m_token string. | |
| NodeTest | back to summary |
|---|---|
| protected void NodeTest(int axesType) throws TransformerException NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'
| |
| Number | back to summary |
|---|---|
| protected void Number() throws TransformerException Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+ | |
| NumberExpr | back to summary |
|---|---|
| protected void NumberExpr() throws TransformerException NumberExpr ::= Expr | |
| OrExpr | back to summary |
|---|---|
| protected void OrExpr() throws TransformerException OrExpr ::= AndExpr | OrExpr 'or' AndExpr | |
| PathExpr | back to summary |
|---|---|
| protected void PathExpr() throws TransformerException PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath
| |
| Pattern | back to summary |
|---|---|
| protected void Pattern() throws TransformerException Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern | |
| Predicate | back to summary |
|---|---|
| protected void Predicate() throws TransformerException Predicate ::= '[' PredicateExpr ']' | |
| PredicateExpr | back to summary |
|---|---|
| protected void PredicateExpr() throws TransformerException PredicateExpr ::= Expr | |
| prevToken | back to summary |
|---|---|
| private final void prevToken() Retrieve the previous token from the command and store it in m_token string. | |
| PrimaryExpr | back to summary |
|---|---|
| protected boolean PrimaryExpr() throws TransformerException PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall
| |
| QName | back to summary |
|---|---|
| protected void QName() throws TransformerException QName ::= (Prefix ':')? LocalPart Prefix ::= NCName LocalPart ::= NCName | |
| RelationalExpr | back to summary |
|---|---|
| protected int RelationalExpr(int addPos) throws TransformerException . returns an Object which is either a String, a Number, a Boolean, or a vector of nodes. RelationalExpr ::= AdditiveExpr | RelationalExpr '<' AdditiveExpr | RelationalExpr '>' AdditiveExpr | RelationalExpr '<=' AdditiveExpr | RelationalExpr '>=' AdditiveExpr
| |
| RelativeLocationPath | back to summary |
|---|---|
| protected boolean RelativeLocationPath() throws TransformerException RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
| |
| RelativePathPattern | back to summary |
|---|---|
| protected void RelativePathPattern() throws TransformerException RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern | |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorListener handler) Allow an application to register an error event handler, where syntax errors will be sent. If the error listener is not set, syntax errors will be sent to System.err.
| |
| Step | back to summary |
|---|---|
| protected boolean Step() throws TransformerException Step ::= Basis Predicate | AbbreviatedStep
| |
| StepPattern | back to summary |
|---|---|
| protected boolean StepPattern(boolean isLeadingSlashPermitted) throws TransformerException StepPattern ::= AbbreviatedNodeTestStep
| |
| StringExpr | back to summary |
|---|---|
| protected void StringExpr() throws TransformerException StringExpr ::= Expr | |
| tokenIs | back to summary |
|---|---|
| pack-priv final boolean tokenIs(String s) Check whether m_token matches the target string.
| |
| tokenIs | back to summary |
|---|---|
| pack-priv final boolean tokenIs(char c) Check whether m_tokenChar==c.
| |
| UnaryExpr | back to summary |
|---|---|
| protected void UnaryExpr() throws TransformerException UnaryExpr ::= UnionExpr | '-' UnaryExpr | |
| UnionExpr | back to summary |
|---|---|
| protected void UnionExpr() throws TransformerException The context of the right hand side expressions is the context of the left hand side expression. The results of the right hand side expressions are node sets. The result of the left hand side UnionExpr is the union of the results of the right hand side expressions. UnionExpr ::= PathExpr | UnionExpr '|' PathExpr | |
| warn | back to summary |
|---|---|
| pack-priv void warn(String msg, Object[] args) throws TransformerException Warn the user of a problem.
| |