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'sXPathReaderwhich generates callbacks to anXPathHandler.
-
-
Field Summary
Fields Modifier and Type Field Description private static XPathHandlerdefaultHandlerprivate XPathHandlerhandlerprivate XPathLexerlexerprivate java.util.ArrayListtokens
-
Constructor Summary
Constructors Constructor Description XPathReader()Create a newXPathReaderwith a do-nothingXPathHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidabbrStep()private voidabsoluteLocationPath()private voidadditiveExpr()private voidandExpr()private voidarguments()private intaxisSpecifier()private XPathSyntaxExceptioncreateSyntaxException(java.lang.String message)private voidequalityExpr()private voidexpr()private voidfilterExpr()private voidfunctionCall()XPathHandlergetXPathHandler()Retrieve the currentXPathHandlerwhich receives the event callbacks.private booleanisNodeTypeName(Token name)private intLA(int position)private voidliteral()(package private) voidlocationPath(boolean isAbsolute)private TokenLT(int position)private Tokenmatch(int tokenType)private voidmultiplicativeExpr()private voidnameTest(int axis)private voidnodeTest(int axis)private voidnodeTypeTest(int axis)private voidorExpr()voidparse(java.lang.String xpath)Parse an XPath expression, and send event callbacks to anXPathHandler.private voidpathExpr()(package private) voidpredicate()private voidpredicateExpr()private voidpredicates()private voidrelationalExpr()private voidrelativeLocationPath()(package private) voidsetUpParse(java.lang.String xpath)voidsetXPathHandler(XPathHandler handler)Set theXPathHandlerto receive event callbacks during the parse.(package private) voidstep()private voidsteps()private voidthrowInvalidAxis(java.lang.String invalidAxis)private voidunaryExpr()private voidunionExpr()private voidvariableReference()
-
-
-
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:SAXPathEventSourceSet theXPathHandlerto receive event callbacks during the parse.- Specified by:
setXPathHandlerin interfaceSAXPathEventSource- Parameters:
handler- the handler to receive callbacks
-
getXPathHandler
public XPathHandler getXPathHandler()
Description copied from interface:SAXPathEventSourceRetrieve the currentXPathHandlerwhich receives the event callbacks.- Specified by:
getXPathHandlerin interfaceSAXPathEventSource- Returns:
- the currently installed
XPathHandler
-
parse
public void parse(java.lang.String xpath) throws SAXPathExceptionDescription copied from interface:XPathReaderParse an XPath expression, and send event callbacks to anXPathHandler.- Specified by:
parsein 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
-
-