APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.compiler

public Class XPathParser

extends Object
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.utils.PrefixResolver, com.sun.org.apache.xpath.internal.XPathProcessorException, com.sun.org.apache.xpath.internal.objects.XNumber, .XString, com.sun.org.apache.xpath.internal.res.XPATHErrorResources, javax.xml.transform.ErrorListener, .SourceLocator, .TransformerException, jdk.xml.internal.XMLSecurityManager

Tokenizes and parses XPath expressions. This should really be named XPathParserImpl, and may be renamed in the future.

Field Summary

Modifier and TypeField 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

Constructor Summary

AccessConstructor and Description
public
XPathParser(ErrorListener errorListener, SourceLocator sourceLocator, XMLSecurityManager xmlSecMgr)

The parser constructor.

Method Summary

Modifier and TypeMethod and Description
protected boolean

Returns:

boolean indicating whether a slash following the step was consumed
AbbreviatedNodeTestStep
(boolean
a 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.
AdditiveExpr
(int
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
AndExpr()

AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr

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
Argument()

Argument ::= Expr

private void
assertion(boolean
If false, a runtime exception will be thrown.
b
,
String
The assertion message, which should be informative.
msg
)

Notify the user of an assertion error, and probably throw an exception.

protected int

Returns:

FROM_XXX axes type, found in com.sun.org.apache.xpath.internal.compiler.Keywords.
AxisName
()

Basis ::= AxisName '::' NodeTest | AbbreviatedBasis

protected void
Basis()

Basis ::= AxisName '::' NodeTest | AbbreviatedBasis

protected void
BooleanExpr()

StringExpr ::= Expr

private void
checkNodeSet()

Checks whether the operand is a location path, reports error if not.

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.
dumpRemainingTokenQueue
()

Dump the remaining token queue.

protected int

Returns:

the position at the end of the equality expression.
EqualityExpr
(int
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 com.sun.org.apache.xpath.internal.res.XPATHErrorResources, which is a key for a format string.
msg
,
Object[]
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
Expr()

Expr ::= OrExpr

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 FilterExpr
FilterExpr
()

FilterExpr ::= PrimaryExpr | FilterExpr Predicate

protected boolean

Returns:

true if, and only if, a FunctionCall was matched
FunctionCall
()

FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)?

public ErrorListener

Returns:

The error listener, which should not normally be null, but may be.
getErrorListener
()

Return the current error listener.

pack-priv final int

Returns:

The function ID, which may correspond to one of the FUNC_XXX values found in com.sun.org.apache.xpath.internal.compiler.FunctionTable, but may be a value installed by an external module.
getFunctionToken
(String
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.
getTokenRelative
(int
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 otherwise
isNodesetFunction
(int
the function token
funcTok
)

Checks whether the function token represents a function that returns a nodeset.

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?

pack-priv final boolean

Returns:

true if the next token matches the character argument.
lookahead
(char
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

Returns:

true if the token behind the current token matches the string argument.
lookahead
(String
the string to compare it to.
s
,
int
number of tokens to lookahead. Must be greater than 1.
n
)

Look ahead of the current token in order to make a branching decision.

private final boolean

Returns:

true if the token behind the current token matches the character argument.
lookbehind
(char
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.
lookbehindHasToken
(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 current token in order to see if there is a useable token.

protected int

Returns:

the position at the end of the equality expression.
MultiplicativeExpr
(int
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
nextToken()

Retrieve the next token from the command and store it in m_token string.

protected void
NodeTest(int axesType)

NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'

protected void
Number()

Number ::= [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

private final void
prevToken()

Retrieve the previous token from the command and store it in m_token string.

protected boolean

Returns:

true if this method successfully matched a PrimaryExpr
PrimaryExpr
()

PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall

protected void
QName()

QName ::= (Prefix ':')?

protected int

Returns:

the position at the end of the relational expression.
RelationalExpr
(int
Position where expression is to be added, or -1 for append.
addPos
)

.

protected boolean

Returns:

true if, and only if, a RelativeLocationPath was matched
RelativeLocationPath
()

RelativeLocationPath ::= 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, otherwise
Step
()

Step ::= Basis Predicate | AbbreviatedStep

protected boolean

Returns:

boolean indicating whether a slash following the step was consumed
StepPattern
(boolean
a boolean indicating whether a slash can appear at the start of this step
isLeadingSlashPermitted
)

StepPattern ::= AbbreviatedNodeTestStep

protected void
StringExpr()

StringExpr ::= Expr

pack-priv final boolean

Returns:

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
(String
A string reference or null.
s
)

Check whether m_token matches the target string.

pack-priv final boolean

Returns:

If m_token is null, returns false, or return true if c matches the current token.
tokenIs
(char
A character to be tested.
c
)

Check whether m_tokenChar==c.

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.

pack-priv void
warn(String
An error msgkey that corresponds to one of the constants found in com.sun.org.apache.xpath.internal.res.XPATHErrorResources, which is a key for a format string.
msg
,
Object[]
An array of arguments represented in the format string, which may be null.
args
)

Warn the user of a problem.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONTINUE_AFTER_FATAL_ERRORback to summary
public static final String CONTINUE_AFTER_FATAL_ERROR
countPredicateback to summary
private int countPredicate
FILTER_MATCH_FAILEDback to summary
protected static final int FILTER_MATCH_FAILED

Results from checking FilterExpr syntax

FILTER_MATCH_PREDICATESback to summary
protected static final int FILTER_MATCH_PREDICATES
FILTER_MATCH_PRIMARYback to summary
protected static final int FILTER_MATCH_PRIMARY
isLocationPathback to summary
pack-priv boolean isLocationPath
lPathRequiredback to summary
pack-priv boolean lPathRequired
m_errorListenerback to summary
private ErrorListener m_errorListener

The error listener where syntax errors are to be sent.

m_functionTableback to summary
private FunctionTable m_functionTable

The table contains build-in functions and customized functions

m_namespaceContextback to summary
pack-priv PrefixResolver m_namespaceContext

The prefix resolver to map prefixes to namespaces in the OpMap.

m_opsback to summary
private OpMap m_ops

The XPath to be processed.

m_queueMarkback to summary
pack-priv int m_queueMark

The position in the token queue is tracked by m_queueMark.

m_sourceLocatorback to summary
pack-priv SourceLocator m_sourceLocator

The source location of the XPath.

m_tokenback to summary
pack-priv transient String m_token

The next token in the pattern.

m_tokenCharback 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_xmlSecMgrback to summary
pack-priv XMLSecurityManager m_xmlSecMgr
nextTokenReadback to summary
pack-priv boolean nextTokenRead

Constructor Detail

XPathParserback to summary
public XPathParser(ErrorListener errorListener, SourceLocator sourceLocator, XMLSecurityManager xmlSecMgr)

The parser constructor.

Method Detail

AbbreviatedNodeTestStepback to summary
protected boolean AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted) throws TransformerException

AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate

Parameters
isLeadingSlashPermitted:boolean

a boolean indicating whether a slash can appear at the start of this step

Returns:boolean

boolean indicating whether a slash following the step was consumed

AdditiveExprback 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

Parameters
addPos:int

Position where expression is to be added, or -1 for append.

Returns:int

the position at the end of the equality expression.

AndExprback to summary
protected void AndExpr() throws TransformerException

AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr

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

Parameters
length:int

The length of the operation.

op:int

The op code to the inserted.

Argumentback to summary
protected void Argument() throws TransformerException

Argument ::= Expr

assertionback to summary
private void assertion(boolean b, String msg)

Notify the user of an assertion error, and probably throw an exception.

Parameters
b:boolean

If false, a runtime exception will be thrown.

msg:String

The assertion message, which should be informative.

Exceptions
RuntimeException:
if the b argument is false.
AxisNameback to summary
protected int AxisName() throws TransformerException

Basis ::= AxisName '::' NodeTest | AbbreviatedBasis

Returns:int

FROM_XXX axes type, found in com.sun.org.apache.xpath.internal.compiler.Keywords.

Basisback to summary
protected void Basis() throws TransformerException

Basis ::= AxisName '::' NodeTest | AbbreviatedBasis

BooleanExprback to summary
protected void BooleanExpr() throws TransformerException

StringExpr ::= Expr

checkNodeSetback to summary
private void checkNodeSet() throws TransformerException

Checks whether the operand is a location path, reports error if not.

Exceptions
TransformerException:
if an error is found
consumeExpectedback to summary
private final void consumeExpected(char expected) throws TransformerException

Consume an expected token, throwing an exception if it isn't there.

Parameters
expected:char

the character to be expected.

dumpRemainingTokenQueueback to summary
protected String dumpRemainingTokenQueue()

Dump the remaining token queue. Thanks to Craig for this.

Returns:String

A dump of the remaining token queue, which may be appended to an error message.

EqualityExprback 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

Parameters
addPos:int

Position where expression is to be added, or -1 for append.

Returns:int

the position at the end of the equality expression.

errorback to summary
pack-priv void error(String msg, Object[] args) throws TransformerException

Notify the user of an error, and probably throw an exception.

Parameters
msg:String

An error msgkey that corresponds to one of the constants found in com.sun.org.apache.xpath.internal.res.XPATHErrorResources, which is a key for a format string.

args:Object[]

An array of arguments represented in the format string, which may be null.

Exceptions
TransformerException:
if the current ErrorListoner determines to throw an exception.
Exprback to summary
protected void Expr() throws TransformerException

Expr ::= OrExpr

FilterExprback to summary
protected int FilterExpr() throws TransformerException

FilterExpr ::= PrimaryExpr | FilterExpr Predicate

Returns:int

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 FilterExpr

Exceptions
XPathProcessorException:
thrown if the active ProblemListener and XPathContext decide the error condition is severe enough to halt processing.
FunctionCallback to summary
protected boolean FunctionCall() throws TransformerException

FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'

Returns:boolean

true if, and only if, a FunctionCall was matched

getErrorListenerback to summary
public ErrorListener getErrorListener()

Return the current error listener.

Returns:ErrorListener

The error listener, which should not normally be null, but may be.

getFunctionTokenback to summary
pack-priv final int getFunctionToken(String key)

Given a string, return the corresponding function token.

Parameters
key:String

A local name of a function.

Returns:int

The function ID, which may correspond to one of the FUNC_XXX values found in com.sun.org.apache.xpath.internal.compiler.FunctionTable, but may be a value installed by an external module.

getTokenRelativeback to summary
private final String getTokenRelative(int i)

Retrieve a token relative to the current token.

Parameters
i:int

Position relative to current token.

Returns:String

The string at the given index, or null if the index is out of range.

IdKeyPatternback to summary
protected void IdKeyPattern() throws TransformerException

IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc())

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

Parameters
compiler:Compiler

The XPath object to be initialized.

expression:String

A String representing the XPath.

namespaceContext:PrefixResolver

An object that is able to resolve prefixes in the XPath to namespaces.

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

Parameters
compiler:Compiler

The compiler object.

expression:String

A string conforming to the XPath grammar.

namespaceContext:PrefixResolver

An object that is able to resolve prefixes in the XPath to namespaces.

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

Parameters
pos:int

The position where the op is to be inserted.

length:int

The length of the operation space in the op map.

op:int

The op code to the inserted.

isNodesetFunctionback to summary
private boolean isNodesetFunction(int funcTok)

Checks whether the function token represents a function that returns a nodeset.

Parameters
funcTok:int

the function token

Returns:boolean

true if the function token represents a function that returns a nodeset, false otherwise

Literalback to summary
protected void Literal() throws TransformerException

The value of the Literal is the sequence of characters inside the " or ' characters>. Literal ::= '"' [^"]* '"' | "'" [^']* "'"

LocationPathback to summary
protected void LocationPath() throws TransformerException

LocationPath ::= RelativeLocationPath | AbsoluteLocationPath

LocationPathPatternback to summary
protected void LocationPathPattern() throws TransformerException

LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//') RelativePathPattern)? | '//'? RelativePathPattern

lookaheadback to summary
pack-priv final boolean lookahead(char c, int n)

Look ahead of the current token in order to make a branching decision.

Parameters
c:char

the character to be tested for.

n:int

number of tokens to look ahead. Must be greater than 1.

Returns:boolean

true if the next token matches the character argument.

lookaheadback to summary
private final boolean lookahead(String s, int n)

Look ahead of the current token in order to make a branching decision.

Parameters
s:String

the string to compare it to.

n:int

number of tokens to lookahead. Must be greater than 1.

Returns:boolean

true if the token behind the current token matches the string argument.

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

Parameters
c:char

the character to compare it to.

n: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.

Returns:boolean

true if the token behind the current token matches the character argument.

lookbehindHasTokenback to summary
private final boolean lookbehindHasToken(int n)

look behind the current token in order to see if there is a useable token.

Parameters
n: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.

Returns:boolean

true if look behind has a token, false otherwise.

MultiplicativeExprback 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

Parameters
addPos:int

Position where expression is to be added, or -1 for append.

Returns:int

the position at the end of the equality expression.

NCNameback to summary
protected void NCName() throws TransformerException

NCName ::= (Letter | '_') (NCNameChar) NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender

nextTokenback to summary
private final void nextToken() throws TransformerException

Retrieve the next token from the command and store it in m_token string.

NodeTestback to summary
protected void NodeTest(int axesType) throws TransformerException

NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'

Parameters
axesType:int

FROM_XXX axes type, found in com.sun.org.apache.xpath.internal.compiler.Keywords.

Numberback to summary
protected void Number() throws TransformerException

Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+

NumberExprback to summary
protected void NumberExpr() throws TransformerException

NumberExpr ::= Expr

OrExprback to summary
protected void OrExpr() throws TransformerException

OrExpr ::= AndExpr | OrExpr 'or' AndExpr

PathExprback to summary
protected void PathExpr() throws TransformerException

PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath

Exceptions
XPathProcessorException:
thrown if the active ProblemListener and XPathContext decide the error condition is severe enough to halt processing.
Patternback to summary
protected void Pattern() throws TransformerException

Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern

Predicateback to summary
protected void Predicate() throws TransformerException

Predicate ::= '[' PredicateExpr ']'

PredicateExprback to summary
protected void PredicateExpr() throws TransformerException

PredicateExpr ::= Expr

prevTokenback to summary
private final void prevToken()

Retrieve the previous token from the command and store it in m_token string.

PrimaryExprback to summary
protected boolean PrimaryExpr() throws TransformerException

PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall

Returns:boolean

true if this method successfully matched a PrimaryExpr

QNameback to summary
protected void QName() throws TransformerException

QName ::= (Prefix ':')? LocalPart Prefix ::= NCName LocalPart ::= NCName

RelationalExprback 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

Parameters
addPos:int

Position where expression is to be added, or -1 for append.

Returns:int

the position at the end of the relational expression.

RelativeLocationPathback to summary
protected boolean RelativeLocationPath() throws TransformerException

RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath

Returns:boolean

true if, and only if, a RelativeLocationPath was matched

RelativePathPatternback to summary
protected void RelativePathPattern() throws TransformerException

RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern

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

Parameters
handler:ErrorListener

Reference to error listener where syntax errors will be sent.

Stepback to summary
protected boolean Step() throws TransformerException

Step ::= Basis Predicate | AbbreviatedStep

Returns:boolean

false if step was empty (or only a '/'); true, otherwise

StepPatternback to summary
protected boolean StepPattern(boolean isLeadingSlashPermitted) throws TransformerException

StepPattern ::= AbbreviatedNodeTestStep

Parameters
isLeadingSlashPermitted:boolean

a boolean indicating whether a slash can appear at the start of this step

Returns:boolean

boolean indicating whether a slash following the step was consumed

StringExprback to summary
protected void StringExpr() throws TransformerException

StringExpr ::= Expr

tokenIsback to summary
pack-priv final boolean tokenIs(String s)

Check whether m_token matches the target string.

Parameters
s:String

A string reference or null.

Returns:boolean

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.

tokenIsback to summary
pack-priv final boolean tokenIs(char c)

Check whether m_tokenChar==c.

Parameters
c:char

A character to be tested.

Returns:boolean

If m_token is null, returns false, or return true if c matches the current token.

UnaryExprback to summary
protected void UnaryExpr() throws TransformerException

UnaryExpr ::= UnionExpr | '-' UnaryExpr

UnionExprback 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

warnback to summary
pack-priv void warn(String msg, Object[] args) throws TransformerException

Warn the user of a problem.

Parameters
msg:String

An error msgkey that corresponds to one of the constants found in com.sun.org.apache.xpath.internal.res.XPATHErrorResources, which is a key for a format string.

args:Object[]

An array of arguments represented in the format string, which may be null.

Exceptions
TransformerException:
if the current ErrorListoner determines to throw an exception.