| java.lang.Object org.apache.xpath.compiler.XPathParser
XPathParser | public class XPathParser (Code) | | Tokenizes and parses XPath expressions. This should really be named
XPathParserImpl, and may be renamed in the future.
|
Method Summary | |
protected boolean | AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted) | protected int | AdditiveExpr(int addPos) This has to handle construction of the operations so that they are evaluated
in pre-fix order. | protected void | AndExpr() | protected void | Argument() | protected int | AxisName() | protected void | Basis() | protected void | BooleanExpr() | protected int | EqualityExpr(int addPos) Parameters: addPos - Position where expression is to be added, or -1 for append. | protected void | Expr() | protected int | FilterExpr() FilterExpr ::= PrimaryExpr
| FilterExpr Predicate
throws: XSLProcessorException - thrown if the active ProblemListener and XPathContext decidethe error condition is severe enough to halt processing. | protected boolean | FunctionCall() | protected void | IdKeyPattern() | protected void | Literal() The value of the Literal is the sequence of characters inside
the " or ' characters>. | protected void | LocationPath() | protected void | LocationPathPattern() | protected int | MultiplicativeExpr(int addPos) This has to handle construction of the operations so that they are evaluated
in pre-fix order. | protected void | NCName() | protected void | NodeTest(int axesType) | protected void | Number() | protected void | NumberExpr() | protected void | OrExpr() | protected void | PathExpr() | protected void | Pattern() | protected void | Predicate() | protected void | PredicateExpr() | protected boolean | PrimaryExpr() | protected void | QName() | protected int | RelationalExpr(int addPos) .
Parameters: addPos - Position where expression is to be added, or -1 for append. | protected boolean | RelativeLocationPath() | protected void | RelativePathPattern() | protected boolean | Step() | protected boolean | StepPattern(boolean isLeadingSlashPermitted) | protected void | StringExpr() | protected void | UnaryExpr() | protected void | UnionExpr() The context of the right hand side expressions is the context of the
left hand side expression. | void | appendOp(int length, int op) Insert room for operation. | protected String | dumpRemainingTokenQueue() Dump the remaining token queue. | void | error(String msg, Object[] args) Notify the user of an error, and probably throw an
exception. | void | errorForDOM3(String msg, Object[] args) This method is added to support DOM 3 XPath API.
This method is exactly like error(String, Object[]); except that
the underlying TransformerException is
XpathStylesheetDOM3Exception (which extends TransformerException).
So older XPath code in Xalan is not affected by this. | public ErrorListener | getErrorListener() Return the current error listener. | final int | getFunctionToken(String key) Given a string, return the corresponding function token.
Parameters: key - A local name of a function. | public void | initMatchPattern(Compiler compiler, String expression, PrefixResolver 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 compiler, String expression, PrefixResolver 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. | void | insertOp(int pos, int length, int op) Insert room for operation. | final boolean | lookahead(char c, int n) Look ahead of the current token in order to
make a branching decision.
Parameters: c - the character to be tested for. Parameters: n - number of tokens to look ahead. | public void | setErrorHandler(ErrorListener handler) Allow an application to register an error event handler, where syntax
errors will be sent. | final boolean | tokenIs(String s) Check whether m_token matches the target string. | final boolean | tokenIs(char c) Check whether m_tokenChar==c. | void | warn(String msg, Object[] args) Warn the user of a problem. |
CONTINUE_AFTER_FATAL_ERROR | final public static String CONTINUE_AFTER_FATAL_ERROR(Code) | | |
FILTER_MATCH_FAILED | final protected static int FILTER_MATCH_FAILED(Code) | | Results from checking FilterExpr syntax
|
FILTER_MATCH_PREDICATES | final protected static int FILTER_MATCH_PREDICATES(Code) | | |
FILTER_MATCH_PRIMARY | final protected static int FILTER_MATCH_PRIMARY(Code) | | |
m_namespaceContext | PrefixResolver m_namespaceContext(Code) | | The prefix resolver to map prefixes to namespaces in the OpMap.
|
m_queueMark | int m_queueMark(Code) | | The position in the token queue is tracked by m_queueMark.
|
m_token | transient String m_token(Code) | | The next token in the pattern.
|
m_tokenChar | transient char m_tokenChar(Code) | | 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.
|
AbbreviatedNodeTestStep | protected boolean AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted) throws javax.xml.transform.TransformerException(Code) | | AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate
Parameters: isLeadingSlashPermitted - a boolean indicating whether a slash canappear at the start of this step boolean indicating whether a slash following the step was consumed throws: javax.xml.transform.TransformerException - |
AdditiveExpr | protected int AdditiveExpr(int addPos) throws javax.xml.transform.TransformerException(Code) | | 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
Parameters: addPos - Position where expression is to be added, or -1 for append. the position at the end of the equality expression. throws: javax.xml.transform.TransformerException - |
FilterExpr | protected int FilterExpr() throws javax.xml.transform.TransformerException(Code) | | FilterExpr ::= PrimaryExpr
| FilterExpr Predicate
throws: XSLProcessorException - thrown if the active ProblemListener and XPathContext decidethe error condition is severe enough to halt processing. FILTER_MATCH_PREDICATES, if this method successfully matched aFilterExpr with one or more Predicates;FILTER_MATCH_PRIMARY, if this method successfully matched aFilterExpr that was just a PrimaryExpr; orFILTER_MATCH_FAILED, if this method did not match a FilterExpr throws: javax.xml.transform.TransformerException - |
MultiplicativeExpr | protected int MultiplicativeExpr(int addPos) throws javax.xml.transform.TransformerException(Code) | | 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
Parameters: addPos - Position where expression is to be added, or -1 for append. the position at the end of the equality expression. throws: javax.xml.transform.TransformerException - |
NCName | protected void NCName()(Code) | | NCName ::= (Letter | '_') (NCNameChar)
NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
|
UnionExpr | protected void UnionExpr() throws javax.xml.transform.TransformerException(Code) | | 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
throws: javax.xml.transform.TransformerException - |
appendOp | void appendOp(int length, int op)(Code) | | Insert room for operation. This WILL set
the length value of the operation, and will update
the length value for the total expression.
Parameters: length - The length of the operation. Parameters: op - The op code to the inserted. |
dumpRemainingTokenQueue | protected String dumpRemainingTokenQueue()(Code) | | Dump the remaining token queue.
Thanks to Craig for this.
A dump of the remaining token queue, which may be appended to an error message. |
errorForDOM3 | void errorForDOM3(String msg, Object[] args) throws TransformerException(Code) | | This method is added to support DOM 3 XPath API.
This method is exactly like error(String, Object[]); except that
the underlying TransformerException is
XpathStylesheetDOM3Exception (which extends TransformerException).
So older XPath code in Xalan is not affected by this. To older XPath code
the behavior of whether error() or errorForDOM3() is called because it is
always catching TransformerException objects and is oblivious to
the new subclass of XPathStylesheetDOM3Exception. Older XPath code
runs as before.
However, newer DOM3 XPath code upon catching a TransformerException can
can check if the exception is an instance of XPathStylesheetDOM3Exception
and take appropriate action.
Parameters: msg - An error msgkey that corresponds to one of the constants found in org.apache.xpath.res.XPATHErrorResources, which is a key for a format string. Parameters: args - An array of arguments represented in the format string, which may be null. throws: TransformerException - if the current ErrorListoner determines to throw an exception. |
getErrorListener | public ErrorListener getErrorListener()(Code) | | Return the current error listener.
The error listener, which should not normally be null, but may be. |
getFunctionToken | final int getFunctionToken(String key)(Code) | | Given a string, return the corresponding function token.
Parameters: key - A local name of a function. The function ID, which may correspond to one of the FUNC_XXX values found in org.apache.xpath.compiler.FunctionTable, but may be a value installed by an external module. |
initMatchPattern | public void initMatchPattern(Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException(Code) | | 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.
Parameters: compiler - The XPath object to be initialized. Parameters: expression - A String representing the XPath. Parameters: namespaceContext - An object that is able to resolve prefixes inthe XPath to namespaces. throws: javax.xml.transform.TransformerException - |
insertOp | void insertOp(int pos, int length, int op)(Code) | | Insert room for operation. This will NOT set
the length value of the operation, but will update
the length value for the total expression.
Parameters: pos - The position where the op is to be inserted. Parameters: length - The length of the operation space in the op map. Parameters: op - The op code to the inserted. |
lookahead | final boolean lookahead(char c, int n)(Code) | | Look ahead of the current token in order to
make a branching decision.
Parameters: c - the character to be tested for. Parameters: n - number of tokens to look ahead. Must begreater than 1. true if the next token matches the character argument. |
setErrorHandler | public void setErrorHandler(ErrorListener handler)(Code) | | 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.
Parameters: handler - Reference to error listener where syntax errors will be sent. |
tokenIs | final boolean tokenIs(String s)(Code) | | Check whether m_token matches the target string.
Parameters: s - A string reference or null. If m_token is null, returns false (or true if s is also null), or return true if the current token matches the string, else false. |
tokenIs | final boolean tokenIs(char c)(Code) | | Check whether m_tokenChar==c.
Parameters: c - A character to be tested. If m_token is null, returns false, or return true if c matches the current token. |
|
|