Package org.jaxen.saxpath.base
Class XPathReader
- java.lang.Object
-
- org.jaxen.saxpath.base.XPathReader
-
- All Implemented Interfaces:
SAXPathEventSource
,XPathReader
public class XPathReader extends java.lang.Object implements XPathReader
Implementation of SAXPath'sXPathReader
which generates callbacks to anXPathHandler
.
-
-
Field Summary
Fields Modifier and Type Field Description private static XPathHandler
defaultHandler
private XPathHandler
handler
private XPathLexer
lexer
private java.util.ArrayList
tokens
-
Constructor Summary
Constructors Constructor Description XPathReader()
Create a newXPathReader
with a do-nothingXPathHandler
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
abbrStep()
private void
absoluteLocationPath()
private void
additiveExpr()
private void
andExpr()
private void
arguments()
private int
axisSpecifier()
private XPathSyntaxException
createSyntaxException(java.lang.String message)
private void
equalityExpr()
private void
expr()
private void
filterExpr()
private void
functionCall()
XPathHandler
getXPathHandler()
Retrieve the currentXPathHandler
which receives the event callbacks.private boolean
isNodeTypeName(Token name)
private int
LA(int position)
private void
literal()
(package private) void
locationPath(boolean isAbsolute)
private Token
LT(int position)
private Token
match(int tokenType)
private void
multiplicativeExpr()
private void
nameTest(int axis)
private void
nodeTest(int axis)
private void
nodeTypeTest(int axis)
private void
orExpr()
void
parse(java.lang.String xpath)
Parse an XPath expression, and send event callbacks to anXPathHandler
.private void
pathExpr()
(package private) void
predicate()
private void
predicateExpr()
private void
predicates()
private void
relationalExpr()
private void
relativeLocationPath()
(package private) void
setUpParse(java.lang.String xpath)
void
setXPathHandler(XPathHandler handler)
Set theXPathHandler
to receive event callbacks during the parse.(package private) void
step()
private void
steps()
private void
throwInvalidAxis(java.lang.String invalidAxis)
private void
unaryExpr()
private void
unionExpr()
private void
variableReference()
-
-
-
Field Detail
-
tokens
private java.util.ArrayList tokens
-
lexer
private XPathLexer lexer
-
handler
private XPathHandler handler
-
defaultHandler
private static XPathHandler defaultHandler
-
-
Method Detail
-
setXPathHandler
public void setXPathHandler(XPathHandler handler)
Description copied from interface:SAXPathEventSource
Set theXPathHandler
to receive event callbacks during the parse.- Specified by:
setXPathHandler
in interfaceSAXPathEventSource
- Parameters:
handler
- the handler to receive callbacks
-
getXPathHandler
public XPathHandler getXPathHandler()
Description copied from interface:SAXPathEventSource
Retrieve the currentXPathHandler
which receives the event callbacks.- Specified by:
getXPathHandler
in interfaceSAXPathEventSource
- Returns:
- the currently installed
XPathHandler
-
parse
public void parse(java.lang.String xpath) throws SAXPathException
Description copied from interface:XPathReader
Parse an XPath expression, and send event callbacks to anXPathHandler
.- Specified by:
parse
in interfaceXPathReader
- Parameters:
xpath
- the textual XPath expression to parse- Throws:
SAXPathException
- if the expression is syntactically incorrect
-
setUpParse
void setUpParse(java.lang.String xpath)
-
pathExpr
private void pathExpr() throws SAXPathException
- Throws:
SAXPathException
-
literal
private void literal() throws SAXPathException
- Throws:
SAXPathException
-
functionCall
private void functionCall() throws SAXPathException
- Throws:
SAXPathException
-
arguments
private void arguments() throws SAXPathException
- Throws:
SAXPathException
-
filterExpr
private void filterExpr() throws SAXPathException
- Throws:
SAXPathException
-
variableReference
private void variableReference() throws SAXPathException
- Throws:
SAXPathException
-
locationPath
void locationPath(boolean isAbsolute) throws SAXPathException
- Throws:
SAXPathException
-
absoluteLocationPath
private void absoluteLocationPath() throws SAXPathException
- Throws:
SAXPathException
-
relativeLocationPath
private void relativeLocationPath() throws SAXPathException
- Throws:
SAXPathException
-
steps
private void steps() throws SAXPathException
- Throws:
SAXPathException
-
step
void step() throws SAXPathException
- Throws:
SAXPathException
-
axisSpecifier
private int axisSpecifier() throws SAXPathException
- Throws:
SAXPathException
-
nodeTest
private void nodeTest(int axis) throws SAXPathException
- Throws:
SAXPathException
-
nodeTypeTest
private void nodeTypeTest(int axis) throws SAXPathException
- Throws:
SAXPathException
-
nameTest
private void nameTest(int axis) throws SAXPathException
- Throws:
SAXPathException
-
abbrStep
private void abbrStep() throws SAXPathException
- Throws:
SAXPathException
-
predicates
private void predicates() throws SAXPathException
- Throws:
SAXPathException
-
predicate
void predicate() throws SAXPathException
- Throws:
SAXPathException
-
predicateExpr
private void predicateExpr() throws SAXPathException
- Throws:
SAXPathException
-
expr
private void expr() throws SAXPathException
- Throws:
SAXPathException
-
orExpr
private void orExpr() throws SAXPathException
- Throws:
SAXPathException
-
andExpr
private void andExpr() throws SAXPathException
- Throws:
SAXPathException
-
equalityExpr
private void equalityExpr() throws SAXPathException
- Throws:
SAXPathException
-
relationalExpr
private void relationalExpr() throws SAXPathException
- Throws:
SAXPathException
-
additiveExpr
private void additiveExpr() throws SAXPathException
- Throws:
SAXPathException
-
multiplicativeExpr
private void multiplicativeExpr() throws SAXPathException
- Throws:
SAXPathException
-
unaryExpr
private void unaryExpr() throws SAXPathException
- Throws:
SAXPathException
-
unionExpr
private void unionExpr() throws SAXPathException
- Throws:
SAXPathException
-
match
private Token match(int tokenType) throws XPathSyntaxException
- Throws:
XPathSyntaxException
-
LA
private int LA(int position)
-
LT
private Token LT(int position)
-
isNodeTypeName
private boolean isNodeTypeName(Token name)
-
createSyntaxException
private XPathSyntaxException createSyntaxException(java.lang.String message)
-
throwInvalidAxis
private void throwInvalidAxis(java.lang.String invalidAxis) throws SAXPathException
- Throws:
SAXPathException
-
-