org.jaxen.pattern

Class PatternHandler

Implemented Interfaces:
XPathHandler

public class PatternHandler
extends JaxenHandler

SAXPath XPathHandler implementation capable of building Jaxen expression trees which can walk various different object models.
Author:
bob mcwhirter (bob@werken.com)

Field Summary

private Pattern
pattern

Fields inherited from class org.jaxen.JaxenHandler

simplified, stack, xpath, xpathFactory

Constructor Summary

PatternHandler()
Constructor

Method Summary

protected Pattern
createAbsoluteLocationPath()
protected Pattern
createRelativeLocationPath()
void
endAbsoluteLocationPath()
Receive notification of the end of an absolute location path expression.
protected void
endLocationPath()
void
endPathExpr()
Receive notification of the end of a path expression.
void
endRelativeLocationPath()
Receive notification of the end of a relative location path expression.
protected void
endStep()
void
endUnionExpr(boolean create)
Receive notification of the end of a union ('|') expression.
void
endXPath()
Receive notification of the end of an XPath expression parse.
Pattern
getPattern()
Retrieve the simplified Jaxen Pattern expression tree.
Pattern
getPattern(boolean shouldSimplify)
Retrieve the Jaxen Pattern expression tree, optionally simplified.
void
startAbsoluteLocationPath()
Receive notification of the start of an absolute location path expression.
void
startAllNodeStep(int axis)
Receive notification of the start of a node() step.
void
startCommentNodeStep(int axis)
Receive notification of the start of a comment() step.
void
startNameStep(int axis, String prefix, String localName)
Receive notification of the start of a name step.
void
startProcessingInstructionNodeStep(int axis, String name)
Receive notification of the start of a processing-instruction(...) step.
void
startRelativeLocationPath()
Receive notification of the start of a relative location path expression.
void
startTextNodeStep(int axis)
Receive notification of the start of a text() step.
void
startUnionExpr()
Receive notification of the start of a union ('|') expression.

Methods inherited from class org.jaxen.JaxenHandler

addParameters, addPredicates, addSteps, canPop, endAbsoluteLocationPath, endAdditiveExpr, endAllNodeStep, endAndExpr, endCommentNodeStep, endEqualityExpr, endFilterExpr, endFunction, endLocationPath, endMultiplicativeExpr, endNameStep, endOrExpr, endPathExpr, endPredicate, endProcessingInstructionNodeStep, endRelationalExpr, endRelativeLocationPath, endStep, endTextNodeStep, endUnaryExpr, endUnionExpr, endXPath, getXPathExpr, getXPathExpr, getXPathFactory, literal, number, number, peekFrame, pop, popFrame, push, pushFrame, returnExpr, setXPathFactory, stackSize, startAbsoluteLocationPath, startAdditiveExpr, startAllNodeStep, startAndExpr, startCommentNodeStep, startEqualityExpr, startFilterExpr, startFunction, startMultiplicativeExpr, startNameStep, startOrExpr, startPathExpr, startPredicate, startProcessingInstructionNodeStep, startRelationalExpr, startRelativeLocationPath, startTextNodeStep, startUnaryExpr, startUnionExpr, startXPath, variableReference

Field Details

pattern

private Pattern pattern

Constructor Details

PatternHandler

public PatternHandler()
Constructor

Method Details

createAbsoluteLocationPath

protected Pattern createAbsoluteLocationPath()

createRelativeLocationPath

protected Pattern createRelativeLocationPath()

endAbsoluteLocationPath

public void endAbsoluteLocationPath()
            throws JaxenException
Receive notification of the end of an absolute location path expression.
Specified by:
endAbsoluteLocationPath in interface XPathHandler
Overrides:
endAbsoluteLocationPath in interface JaxenHandler

endLocationPath

protected void endLocationPath()
            throws JaxenException
Overrides:
endLocationPath in interface JaxenHandler

endPathExpr

public void endPathExpr()
Receive notification of the end of a path expression.
Specified by:
endPathExpr in interface XPathHandler
Overrides:
endPathExpr in interface JaxenHandler

endRelativeLocationPath

public void endRelativeLocationPath()
            throws JaxenException
Receive notification of the end of a relative location path expression.
Specified by:
endRelativeLocationPath in interface XPathHandler
Overrides:
endRelativeLocationPath in interface JaxenHandler

endStep

protected void endStep()
Overrides:
endStep in interface JaxenHandler

endUnionExpr

public void endUnionExpr(boolean create)
            throws JaxenException
Receive notification of the end of a union ('|') expression.
Specified by:
endUnionExpr in interface XPathHandler
Overrides:
endUnionExpr in interface JaxenHandler
Parameters:
create - flag that indicates if this expression should truly be instantiated, or if it was just a pass-through, based upon the grammar productions

endXPath

public void endXPath()
Receive notification of the end of an XPath expression parse.
Specified by:
endXPath in interface XPathHandler
Overrides:
endXPath in interface JaxenHandler

getPattern

public Pattern getPattern()
Retrieve the simplified Jaxen Pattern expression tree.

This method is only valid once XPathReader.parse(...) successfully returned.

Returns:
The Pattern expression tree.

getPattern

public Pattern getPattern(boolean shouldSimplify)
Retrieve the Jaxen Pattern expression tree, optionally simplified.

This method is only valid once XPathReader.parse(...) successfully returned.

Parameters:
shouldSimplify - ????
Returns:
The Pattern expression tree.

startAbsoluteLocationPath

public void startAbsoluteLocationPath()
Receive notification of the start of an absolute location path expression.
Specified by:
startAbsoluteLocationPath in interface XPathHandler
Overrides:
startAbsoluteLocationPath in interface JaxenHandler

startAllNodeStep

public void startAllNodeStep(int axis)
Receive notification of the start of a node() step.
Specified by:
startAllNodeStep in interface XPathHandler
Overrides:
startAllNodeStep in interface JaxenHandler
Parameters:
axis - the axis of this step

startCommentNodeStep

public void startCommentNodeStep(int axis)
Receive notification of the start of a comment() step.
Specified by:
startCommentNodeStep in interface XPathHandler
Overrides:
startCommentNodeStep in interface JaxenHandler
Parameters:
axis - the axis of this step

startNameStep

public void startNameStep(int axis,
                          String prefix,
                          String localName)
Receive notification of the start of a name step.
Specified by:
startNameStep in interface XPathHandler
Overrides:
startNameStep in interface JaxenHandler
Parameters:
axis - the axis of this step
prefix - the namespace prefix for the name to test, or the empty string if no prefix is specified
localName - the local part of the name to test

startProcessingInstructionNodeStep

public void startProcessingInstructionNodeStep(int axis,
                                               String name)
Receive notification of the start of a processing-instruction(...) step.
Specified by:
startProcessingInstructionNodeStep in interface XPathHandler
Overrides:
startProcessingInstructionNodeStep in interface JaxenHandler
Parameters:
axis - the axis of this step
name - the name of the processing-instruction, or the empty string if none is specified

startRelativeLocationPath

public void startRelativeLocationPath()
Receive notification of the start of a relative location path expression.
Specified by:
startRelativeLocationPath in interface XPathHandler
Overrides:
startRelativeLocationPath in interface JaxenHandler

startTextNodeStep

public void startTextNodeStep(int axis)
Receive notification of the start of a text() step.
Specified by:
startTextNodeStep in interface XPathHandler
Overrides:
startTextNodeStep in interface JaxenHandler
Parameters:
axis - the axis of this step

startUnionExpr

public void startUnionExpr()
Receive notification of the start of a union ('|') expression.
Specified by:
startUnionExpr in interface XPathHandler
Overrides:
startUnionExpr in interface JaxenHandler