org.jaxen.saxpath.base
Class XPathReader

java.lang.Object
  extended by org.jaxen.saxpath.base.XPathReader
All Implemented Interfaces:
SAXPathEventSource, XPathReader

public class XPathReader
extends java.lang.Object
implements XPathReader

Implementation of SAXPath's XPathReader which generates callbacks to an XPathHandler.

Author:
bob mcwhirter (bob@werken.com)

Field Summary
private static XPathHandler defaultHandler
           
private  XPathHandler handler
           
private  XPathLexer lexer
           
private  java.util.ArrayList tokens
           
 
Constructor Summary
XPathReader()
          Create a new XPathReader with a do-nothing XPathHandler.
 
Method Summary
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 current XPathHandler 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 an XPathHandler.
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 the XPathHandler 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

private java.util.ArrayList tokens

lexer

private XPathLexer lexer

handler

private XPathHandler handler

defaultHandler

private static XPathHandler defaultHandler
Constructor Detail

XPathReader

public XPathReader()
Create a new XPathReader with a do-nothing XPathHandler.

Method Detail

setXPathHandler

public void setXPathHandler(XPathHandler handler)
Description copied from interface: SAXPathEventSource
Set the XPathHandler to receive event callbacks during the parse.

Specified by:
setXPathHandler in interface SAXPathEventSource
Parameters:
handler - the handler to receive callbacks

getXPathHandler

public XPathHandler getXPathHandler()
Description copied from interface: SAXPathEventSource
Retrieve the current XPathHandler which receives the event callbacks.

Specified by:
getXPathHandler in interface SAXPathEventSource
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 an XPathHandler.

Specified by:
parse in interface XPathReader
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