Class JaxenHandler
java.lang.Object
org.jaxen.JaxenHandler
- All Implemented Interfaces:
XPathHandler
- Direct Known Subclasses:
PatternHandler
SAXPath
XPathHandler implementation capable
of building Jaxen expression trees which can walk various
different object models.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean????protected LinkedListThis may be changed to an ArrayList in the future (i.e.private XPathExprprivate XPathFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddParameters(FunctionCallExpr function, Iterator paramIter) protected voidaddPredicates(Predicated obj, Iterator predIter) protected voidaddSteps(LocationPath locationPath, Iterator stepIter) protected booleancanPop()voidReceive notification of the end of an absolute location path expression.voidendAdditiveExpr(int operator) Receive notification of the end of an additive ('+' or '-') expression.voidReceive notification of the end of a node() step.voidendAndExpr(boolean create) Receive notification of the end of an 'and' expression.voidReceive notification of the end of a comment() step.voidendEqualityExpr(int operator) Receive notification of the end of an equality ('=' or '!=') expression.voidReceive notification of the end of a filter expression.voidReceive notification of the end of a function callprotected voidvoidendMultiplicativeExpr(int operator) Receive notification of the start of a multiplicative ('*', 'div' or 'mod') expression.voidReceive notification of the end of a NameStepvoidendOrExpr(boolean create) Receive notification of the end of an 'or' expression.voidReceive notification of the end of a path expression.voidReceive notification of the end of a predicate.voidReceive notification of the end of a processing-instruction(...) step.voidendRelationalExpr(int operator) Receive notification of the start of a relational ('<', '>', '<=', or '>=') expression.voidReceive notification of the end of a relative location path expression.protected voidendStep()voidReceive notification of the end of a text() step.voidendUnaryExpr(int operator) Receive notification of the end of a unary ('+' or '-') expression.voidendUnionExpr(boolean create) Receive notification of the end of a union ('|') expression.voidendXPath()Receive notification of the end of an XPath expression parse.Retrieve the simplified Jaxen XPath expression tree.getXPathExpr(boolean shouldSimplify) Retrieve the Jaxen XPath expression tree, optionally simplified.Retrieve the JaxenXPathFactoryused during the parse to construct the XPath expression tree.voidReceive notification of a literal expression.voidnumber(double number) Receive notification of a number expression.voidnumber(int number) Receive notification of a number expression.protected LinkedListprotected Objectpop()protected LinkedListpopFrame()protected voidprotected voidprotected voidvoidsetXPathFactory(XPathFactory xpathFactory) Set the JaxenXPathFactorythat constructs the XPath expression tree during the parse.protected intvoidReceive notification of the start of an absolute location path expression.voidReceive notification of the start of an additive ('+' or '-') expression.voidstartAllNodeStep(int axis) Receive notification of the start of a node() step.voidReceive notification of the start of an 'and' expression.voidstartCommentNodeStep(int axis) Receive notification of the start of a comment() step.voidReceive notification of the start of an equality ('=' or '!=') expression.voidReceive notification of the start of a filter expression.voidstartFunction(String prefix, String functionName) Receive notification of a function call.voidReceive notification of the start of a multiplicative ('*', 'div' or 'mod') expression.voidstartNameStep(int axis, String prefix, String localName) Receive notification of the start of a name step.voidReceive notification of the start of an 'or' expression.voidReceive notification of the start of a path expression.voidReceive notification of the start of a predicate.voidstartProcessingInstructionNodeStep(int axis, String name) Receive notification of the start of a processing-instruction(...) step.voidReceive notification of the start of a relational ('<', '>', '<=', or '>=') expression.voidReceive notification of the start of a relative location path expression.voidstartTextNodeStep(int axis) Receive notification of the start of a text() step.voidReceive notification of the start of a unary ('+' or '-') expression.voidReceive notification of the start of a union ('|') expression.voidReceive notification of the start of an XPath expression parse.voidvariableReference(String prefix, String variableName) Receive notification of a variable-reference expression.
-
Field Details
-
xpathFactory
-
xpath
-
simplified
protected boolean simplified???? -
stack
This may be changed to an ArrayList in the future (i.e. version >= 1.2). You really shouldn't be accessing this field directly, but if you are please try to use it as a generic List. Don't use the methods that are only available in LinkedList.
-
-
Constructor Details
-
JaxenHandler
public JaxenHandler()Constructor
-
-
Method Details
-
setXPathFactory
Set the JaxenXPathFactorythat constructs the XPath expression tree during the parse.- Parameters:
xpathFactory- the factory to use during the parse
-
getXPathFactory
Retrieve the JaxenXPathFactoryused during the parse to construct the XPath expression tree.- Returns:
- the
XPathFactoryused during the parse.
-
getXPathExpr
Retrieve the simplified Jaxen XPath expression tree.This method is only valid once
XPathReader.parse(...)successfully returned.- Returns:
- the XPath expression tree
-
getXPathExpr
Retrieve the Jaxen XPath expression tree, optionally simplified.This method is only valid once
XPathReader.parse(...)successfully returned.- Parameters:
shouldSimplify- ????- Returns:
- the XPath expression tree
-
startXPath
public void startXPath()Description copied from interface:XPathHandlerReceive notification of the start of an XPath expression parse.- Specified by:
startXPathin interfaceXPathHandler
-
endXPath
Description copied from interface:XPathHandlerReceive notification of the end of an XPath expression parse.- Specified by:
endXPathin interfaceXPathHandler- Throws:
JaxenException
-
startPathExpr
public void startPathExpr()Description copied from interface:XPathHandlerReceive notification of the start of a path expression.- Specified by:
startPathExprin interfaceXPathHandler
-
endPathExpr
Description copied from interface:XPathHandlerReceive notification of the end of a path expression.- Specified by:
endPathExprin interfaceXPathHandler- Throws:
JaxenException
-
startAbsoluteLocationPath
Description copied from interface:XPathHandlerReceive notification of the start of an absolute location path expression.- Specified by:
startAbsoluteLocationPathin interfaceXPathHandler- Throws:
JaxenException
-
endAbsoluteLocationPath
Description copied from interface:XPathHandlerReceive notification of the end of an absolute location path expression.- Specified by:
endAbsoluteLocationPathin interfaceXPathHandler- Throws:
JaxenException
-
startRelativeLocationPath
Description copied from interface:XPathHandlerReceive notification of the start of a relative location path expression.- Specified by:
startRelativeLocationPathin interfaceXPathHandler- Throws:
JaxenException
-
endRelativeLocationPath
Description copied from interface:XPathHandlerReceive notification of the end of a relative location path expression.- Specified by:
endRelativeLocationPathin interfaceXPathHandler- Throws:
JaxenException
-
endLocationPath
- Throws:
JaxenException
-
addSteps
-
startNameStep
Description copied from interface:XPathHandlerReceive notification of the start of a name step.- Specified by:
startNameStepin interfaceXPathHandler- Parameters:
axis- the axis of this stepprefix- the namespace prefix for the name to test, or the empty string if no prefix is specifiedlocalName- the local part of the name to test- Throws:
JaxenException
-
endNameStep
public void endNameStep()Description copied from interface:XPathHandlerReceive notification of the end of a NameStep- Specified by:
endNameStepin interfaceXPathHandler
-
startTextNodeStep
Description copied from interface:XPathHandlerReceive notification of the start of a text() step.- Specified by:
startTextNodeStepin interfaceXPathHandler- Parameters:
axis- the axis of this step- Throws:
JaxenException
-
endTextNodeStep
public void endTextNodeStep()Description copied from interface:XPathHandlerReceive notification of the end of a text() step.- Specified by:
endTextNodeStepin interfaceXPathHandler
-
startCommentNodeStep
Description copied from interface:XPathHandlerReceive notification of the start of a comment() step.- Specified by:
startCommentNodeStepin interfaceXPathHandler- Parameters:
axis- the axis of this step- Throws:
JaxenException
-
endCommentNodeStep
public void endCommentNodeStep()Description copied from interface:XPathHandlerReceive notification of the end of a comment() step.- Specified by:
endCommentNodeStepin interfaceXPathHandler
-
startAllNodeStep
Description copied from interface:XPathHandlerReceive notification of the start of a node() step.- Specified by:
startAllNodeStepin interfaceXPathHandler- Parameters:
axis- the axis of this step- Throws:
JaxenException
-
endAllNodeStep
public void endAllNodeStep()Description copied from interface:XPathHandlerReceive notification of the end of a node() step.- Specified by:
endAllNodeStepin interfaceXPathHandler
-
startProcessingInstructionNodeStep
Description copied from interface:XPathHandlerReceive notification of the start of a processing-instruction(...) step.- Specified by:
startProcessingInstructionNodeStepin interfaceXPathHandler- Parameters:
axis- the axis of this stepname- the name of the processing-instruction, or the empty string if none is specified- Throws:
JaxenException
-
endProcessingInstructionNodeStep
public void endProcessingInstructionNodeStep()Description copied from interface:XPathHandlerReceive notification of the end of a processing-instruction(...) step.- Specified by:
endProcessingInstructionNodeStepin interfaceXPathHandler
-
endStep
protected void endStep() -
startPredicate
public void startPredicate()Description copied from interface:XPathHandlerReceive notification of the start of a predicate.- Specified by:
startPredicatein interfaceXPathHandler
-
endPredicate
Description copied from interface:XPathHandlerReceive notification of the end of a predicate.- Specified by:
endPredicatein interfaceXPathHandler- Throws:
JaxenException
-
startFilterExpr
public void startFilterExpr()Description copied from interface:XPathHandlerReceive notification of the start of a filter expression.- Specified by:
startFilterExprin interfaceXPathHandler
-
endFilterExpr
Description copied from interface:XPathHandlerReceive notification of the end of a filter expression.- Specified by:
endFilterExprin interfaceXPathHandler- Throws:
JaxenException
-
addPredicates
-
returnExpr
protected void returnExpr() -
startOrExpr
public void startOrExpr()Description copied from interface:XPathHandlerReceive notification of the start of an 'or' expression.- Specified by:
startOrExprin interfaceXPathHandler
-
endOrExpr
Description copied from interface:XPathHandlerReceive notification of the end of an 'or' expression.- Specified by:
endOrExprin interfaceXPathHandler- 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- Throws:
JaxenException
-
startAndExpr
public void startAndExpr()Description copied from interface:XPathHandlerReceive notification of the start of an 'and' expression.- Specified by:
startAndExprin interfaceXPathHandler
-
endAndExpr
Description copied from interface:XPathHandlerReceive notification of the end of an 'and' expression.- Specified by:
endAndExprin interfaceXPathHandler- 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- Throws:
JaxenException
-
startEqualityExpr
public void startEqualityExpr()Description copied from interface:XPathHandlerReceive notification of the start of an equality ('=' or '!=') expression.- Specified by:
startEqualityExprin interfaceXPathHandler
-
endEqualityExpr
Description copied from interface:XPathHandlerReceive notification of the end of an equality ('=' or '!=') expression.- Specified by:
endEqualityExprin interfaceXPathHandler- Parameters:
operator- the operator specific to this particular equality expression. If null, this expression is only a pass-through, and should not actually be instantiated.- Throws:
JaxenException
-
startRelationalExpr
public void startRelationalExpr()Description copied from interface:XPathHandlerReceive notification of the start of a relational ('<', '>', '<=', or '>=') expression.- Specified by:
startRelationalExprin interfaceXPathHandler
-
endRelationalExpr
Description copied from interface:XPathHandlerReceive notification of the start of a relational ('<', '>', '<=', or '>=') expression.- Specified by:
endRelationalExprin interfaceXPathHandler- Parameters:
operator- the operator specific to this particular relational expression. If NO_OP, this expression is only a pass-through, and should not actually be instantiated.- Throws:
JaxenException
-
startAdditiveExpr
public void startAdditiveExpr()Description copied from interface:XPathHandlerReceive notification of the start of an additive ('+' or '-') expression.- Specified by:
startAdditiveExprin interfaceXPathHandler
-
endAdditiveExpr
Description copied from interface:XPathHandlerReceive notification of the end of an additive ('+' or '-') expression.- Specified by:
endAdditiveExprin interfaceXPathHandler- Parameters:
operator- the operator specific to this particular additive expression. If NO_OP, this expression is only a pass-through, and should not actually be instantiated.- Throws:
JaxenException
-
startMultiplicativeExpr
public void startMultiplicativeExpr()Description copied from interface:XPathHandlerReceive notification of the start of a multiplicative ('*', 'div' or 'mod') expression.- Specified by:
startMultiplicativeExprin interfaceXPathHandler
-
endMultiplicativeExpr
Description copied from interface:XPathHandlerReceive notification of the start of a multiplicative ('*', 'div' or 'mod') expression.- Specified by:
endMultiplicativeExprin interfaceXPathHandler- Parameters:
operator- the operator specific to this particular multiplicative expression. If null, this expression is only a pass-through, and should not actually be instantiated.- Throws:
JaxenException
-
startUnaryExpr
public void startUnaryExpr()Description copied from interface:XPathHandlerReceive notification of the start of a unary ('+' or '-') expression.- Specified by:
startUnaryExprin interfaceXPathHandler
-
endUnaryExpr
Description copied from interface:XPathHandlerReceive notification of the end of a unary ('+' or '-') expression.- Specified by:
endUnaryExprin interfaceXPathHandler- Parameters:
operator- the operator specific to this particular unary expression. If NO_OP, this expression is only a pass-through, and should not actually be instantiated. If notOperator.NO_OP, it will always beOperator.NEGATIVE.- Throws:
JaxenException
-
startUnionExpr
public void startUnionExpr()Description copied from interface:XPathHandlerReceive notification of the start of a union ('|') expression.- Specified by:
startUnionExprin interfaceXPathHandler
-
endUnionExpr
Description copied from interface:XPathHandlerReceive notification of the end of a union ('|') expression.- Specified by:
endUnionExprin interfaceXPathHandler- 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- Throws:
JaxenException
-
number
Description copied from interface:XPathHandlerReceive notification of a number expression.- Specified by:
numberin interfaceXPathHandler- Parameters:
number- the number value- Throws:
JaxenException
-
number
Description copied from interface:XPathHandlerReceive notification of a number expression.- Specified by:
numberin interfaceXPathHandler- Parameters:
number- the number value- Throws:
JaxenException
-
literal
Description copied from interface:XPathHandlerReceive notification of a literal expression.- Specified by:
literalin interfaceXPathHandler- Parameters:
literal- the string literal value- Throws:
JaxenException
-
variableReference
Description copied from interface:XPathHandlerReceive notification of a variable-reference expression.- Specified by:
variableReferencein interfaceXPathHandler- Parameters:
prefix- the namespace prefix of the variablevariableName- the local name of the variable- Throws:
JaxenException
-
startFunction
Description copied from interface:XPathHandlerReceive notification of a function call.- Specified by:
startFunctionin interfaceXPathHandler- Parameters:
prefix- the namespace prefix of the functionfunctionName- the local name of the function- Throws:
JaxenException
-
endFunction
public void endFunction()Description copied from interface:XPathHandlerReceive notification of the end of a function call- Specified by:
endFunctionin interfaceXPathHandler
-
addParameters
-
stackSize
protected int stackSize() -
push
-
pop
-
canPop
protected boolean canPop() -
pushFrame
protected void pushFrame() -
popFrame
-
peekFrame
-