public class XPathParser extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTINUE_AFTER_FATAL_ERROR |
protected static int |
FILTER_MATCH_FAILED
Results from checking FilterExpr syntax
|
protected static int |
FILTER_MATCH_PREDICATES |
protected static int |
FILTER_MATCH_PRIMARY |
| Constructor and Description |
|---|
XPathParser(ErrorListener errorListener)
The parser constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted)
AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate
|
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()
AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr
|
protected void |
Argument()
Argument ::= Expr
|
protected int |
AxisName()
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
|
protected void |
Basis()
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
|
protected void |
BooleanExpr()
StringExpr ::= Expr
|
protected String |
dumpRemainingTokenQueue()
Dump the remaining token queue.
|
protected int |
EqualityExpr(int addPos)
EqualityExpr ::= RelationalExpr | EqualityExpr '=' RelationalExpr
|
protected void |
Expr()
Expr ::= OrExpr
|
protected int |
FilterExpr()
FilterExpr ::= PrimaryExpr | FilterExpr Predicate
|
protected boolean |
FunctionCall()
FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'
|
ErrorListener |
getErrorListener()
Return the current error listener.
|
protected void |
IdKeyPattern()
IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc())
|
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.
|
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.
|
protected void |
Literal()
The value of the Literal is the sequence of characters inside the " or ' characters.
|
protected void |
LocationPath()
LocationPath ::= RelativeLocationPath | AbsoluteLocationPath
|
protected void |
LocationPathPattern()
LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//')
RelativePathPattern)? | '//'? RelativePathPattern
|
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()
NCName ::= (Letter | '_') (NCNameChar) NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
CombiningChar | Extender
|
protected void |
NodeTest(int axesType)
NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'
|
protected void |
Number()
Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+
|
protected void |
NumberExpr()
NumberExpr ::= Expr
|
protected void |
OrExpr()
OrExpr ::= AndExpr | OrExpr 'or' AndExpr
|
protected void |
PathExpr()
PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//'
RelativeLocationPath
|
protected void |
Pattern()
Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern
|
protected void |
Predicate()
Predicate ::= '[' PredicateExpr ']'
|
protected void |
PredicateExpr()
PredicateExpr ::= Expr
|
protected boolean |
PrimaryExpr()
PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall
|
protected void |
QName()
QName ::= (Prefix ':')? LocalPart Prefix ::= NCName LocalPart ::= NCName
|
protected int |
RelationalExpr(int addPos)
RelationalExpr ::= AdditiveExpr | RelationalExpr '<' AdditiveExpr | RelationalExpr '>'
AdditiveExpr | RelationalExpr '<=' AdditiveExpr | RelationalExpr '>=' AdditiveExpr
|
protected boolean |
RelativeLocationPath()
RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
|
protected void |
RelativePathPattern()
RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern
'//' StepPattern
|
void |
setErrorHandler(ErrorListener handler)
Allow an application to register an error event handler, where syntax errors will be sent.
|
protected boolean |
Step()
Step ::= Basis Predicate | AbbreviatedStep
|
protected boolean |
StepPattern(boolean isLeadingSlashPermitted)
StepPattern ::= AbbreviatedNodeTestStep
|
protected void |
StringExpr()
StringExpr ::= Expr
|
protected void |
UnaryExpr()
UnaryExpr ::= UnionExpr | '-' UnaryExpr
|
protected void |
UnionExpr()
The context of the right hand side expressions is the context of the left hand side expression.
|
public static final String CONTINUE_AFTER_FATAL_ERROR
protected static final int FILTER_MATCH_FAILED
protected static final int FILTER_MATCH_PRIMARY
protected static final int FILTER_MATCH_PREDICATES
public XPathParser(ErrorListener errorListener)
public void initXPath(Compiler compiler, String expression, PrefixResolver namespaceContext) throws TransformerException
compiler - The compiler object.expression - A string conforming to the XPath grammar.namespaceContext - An object that is able to resolve prefixes in the XPath to namespaces.TransformerException - in case of errorpublic void initMatchPattern(Compiler compiler, String expression, PrefixResolver namespaceContext) throws TransformerException
compiler - The XPath object to be initialized.expression - A String representing the XPath.namespaceContext - An object that is able to resolve prefixes in the XPath to namespaces.TransformerException - in case of errorpublic void setErrorHandler(ErrorListener handler)
handler - Reference to error listener where syntax errors will be sent.public ErrorListener getErrorListener()
protected String dumpRemainingTokenQueue()
protected void Expr()
throws TransformerException
TransformerException - in case of errorprotected void OrExpr()
throws TransformerException
TransformerException - in case of errorprotected void AndExpr()
throws TransformerException
TransformerException - in case of errorprotected int EqualityExpr(int addPos)
throws TransformerException
addPos - Position where expression is to be added, or -1 for append.TransformerException - in case of errorprotected int RelationalExpr(int addPos)
throws TransformerException
addPos - Position where expression is to be added, or -1 for append.TransformerException - in case of errorprotected int AdditiveExpr(int addPos)
throws TransformerException
AdditiveExpr ::= MultiplicativeExpr | AdditiveExpr '+' MultiplicativeExpr | AdditiveExpr '-' MultiplicativeExpr
addPos - Position where expression is to be added, or -1 for append.TransformerException - in case of errorprotected int MultiplicativeExpr(int addPos)
throws TransformerException
MultiplicativeExpr ::= UnaryExpr | MultiplicativeExpr MultiplyOperator UnaryExpr | MultiplicativeExpr 'div' UnaryExpr | MultiplicativeExpr 'mod' UnaryExpr | MultiplicativeExpr 'quo' UnaryExpr
addPos - Position where expression is to be added, or -1 for append.TransformerException - in case of errorprotected void UnaryExpr()
throws TransformerException
TransformerException - in case of errorprotected void StringExpr()
throws TransformerException
TransformerException - in case of errorprotected void BooleanExpr()
throws TransformerException
TransformerException - in case of errorprotected void NumberExpr()
throws TransformerException
TransformerException - in case of errorprotected void UnionExpr()
throws TransformerException
UnionExpr ::= PathExpr | UnionExpr '|' PathExpr
TransformerException - in case of errorprotected void PathExpr()
throws TransformerException
TransformerException - in case of errorprotected int FilterExpr()
throws TransformerException
TransformerException - in case of errorprotected boolean PrimaryExpr()
throws TransformerException
TransformerException - in case of errorprotected void Argument()
throws TransformerException
TransformerException - in case of errorprotected boolean FunctionCall()
throws TransformerException
TransformerException - in case of errorprotected void LocationPath()
throws TransformerException
TransformerException - in case of errorprotected boolean RelativeLocationPath()
throws TransformerException
TransformerException - in case of errorprotected boolean Step()
throws TransformerException
TransformerException - in case of errorprotected void Basis()
throws TransformerException
TransformerException - in case of errorprotected int AxisName()
throws TransformerException
Keywords.TransformerException - in case of errorprotected void NodeTest(int axesType)
throws TransformerException
axesType - FROM_XXX axes type, found in Keywords.TransformerException - in case of errorprotected void Predicate()
throws TransformerException
TransformerException - in case of errorprotected void PredicateExpr()
throws TransformerException
TransformerException - in case of errorprotected void QName()
throws TransformerException
TransformerException - in case of errorprotected void NCName()
protected void Literal()
throws TransformerException
Literal ::= '"' [^"]* '"' | "'" [^']* "'"
TransformerException - in case of errorprotected void Number()
throws TransformerException
TransformerException - in case of errorprotected void Pattern()
throws TransformerException
TransformerException - in case of errorprotected void LocationPathPattern()
throws TransformerException
TransformerException - in case of errorprotected void IdKeyPattern()
throws TransformerException
TransformerException - in case of errorprotected void RelativePathPattern()
throws TransformerException
TransformerException - in case of errorprotected boolean StepPattern(boolean isLeadingSlashPermitted)
throws TransformerException
isLeadingSlashPermitted - a boolean indicating whether a slash can appear at the start of
this stepTransformerException - in case of errorprotected boolean AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted)
throws TransformerException
isLeadingSlashPermitted - a boolean indicating whether a slash can appear at the start of
this stepTransformerException - in case of errorCopyright © 2022–2023. All rights reserved.