java.lang.Object
org.apache.xpath.XPathVisitor
- public class XPathVisitor
- extends java.lang.Object
A derivation from this class can be passed to a class that implements
the XPathVisitable interface, to have the appropriate method called
for each component of the XPath. Aside from possible other uses, the
main intention is to provide a reasonable means to perform expression
rewriting.
Each method has the form
boolean visitComponentType(ExpressionOwner owner, ComponentType compType).
The ExpressionOwner argument is the owner of the component, and can
be used to reset the expression for rewriting. If a method returns
false, the sub hierarchy will not be traversed.
This class is meant to be a base class that will be derived by concrete classes,
and doesn't much except return true for each method.
|
Method Summary |
boolean |
visitBinaryOperation(ExpressionOwner owner,
org.apache.xpath.operations.Operation op)
Visit a binary operation. |
boolean |
visitFunction(ExpressionOwner owner,
org.apache.xpath.functions.Function func)
Visit a function. |
boolean |
visitLocationPath(ExpressionOwner owner,
org.apache.xpath.axes.LocPathIterator path)
Visit a LocationPath. |
boolean |
visitMatchPattern(ExpressionOwner owner,
org.apache.xpath.patterns.StepPattern pattern)
Visit a match pattern. |
boolean |
visitNumberLiteral(ExpressionOwner owner,
org.apache.xpath.objects.XNumber num)
Visit a number literal. |
boolean |
visitPredicate(ExpressionOwner owner,
Expression pred)
Visit a predicate within a location path. |
boolean |
visitStep(ExpressionOwner owner,
org.apache.xpath.patterns.NodeTest step)
Visit a step within a location path. |
boolean |
visitStringLiteral(ExpressionOwner owner,
org.apache.xpath.objects.XString str)
Visit a string literal. |
boolean |
visitUnaryOperation(ExpressionOwner owner,
org.apache.xpath.operations.UnaryOperation op)
Visit a unary operation. |
boolean |
visitUnionPath(ExpressionOwner owner,
org.apache.xpath.axes.UnionPathIterator path)
Visit a UnionPath. |
boolean |
visitUnionPattern(ExpressionOwner owner,
org.apache.xpath.patterns.UnionPattern pattern)
Visit a union pattern. |
boolean |
visitVariableRef(ExpressionOwner owner,
org.apache.xpath.operations.Variable var)
Visit a variable reference. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XPathVisitor
public XPathVisitor()
visitLocationPath
public boolean visitLocationPath(ExpressionOwner owner,
org.apache.xpath.axes.LocPathIterator path)
- Visit a LocationPath.
visitUnionPath
public boolean visitUnionPath(ExpressionOwner owner,
org.apache.xpath.axes.UnionPathIterator path)
- Visit a UnionPath.
visitStep
public boolean visitStep(ExpressionOwner owner,
org.apache.xpath.patterns.NodeTest step)
- Visit a step within a location path.
visitPredicate
public boolean visitPredicate(ExpressionOwner owner,
Expression pred)
- Visit a predicate within a location path. Note that there isn't a
proper unique component for predicates, and that the expression will
be called also for whatever type Expression is.
visitBinaryOperation
public boolean visitBinaryOperation(ExpressionOwner owner,
org.apache.xpath.operations.Operation op)
- Visit a binary operation.
visitUnaryOperation
public boolean visitUnaryOperation(ExpressionOwner owner,
org.apache.xpath.operations.UnaryOperation op)
- Visit a unary operation.
visitVariableRef
public boolean visitVariableRef(ExpressionOwner owner,
org.apache.xpath.operations.Variable var)
- Visit a variable reference.
visitFunction
public boolean visitFunction(ExpressionOwner owner,
org.apache.xpath.functions.Function func)
- Visit a function.
visitMatchPattern
public boolean visitMatchPattern(ExpressionOwner owner,
org.apache.xpath.patterns.StepPattern pattern)
- Visit a match pattern.
visitUnionPattern
public boolean visitUnionPattern(ExpressionOwner owner,
org.apache.xpath.patterns.UnionPattern pattern)
- Visit a union pattern.
visitStringLiteral
public boolean visitStringLiteral(ExpressionOwner owner,
org.apache.xpath.objects.XString str)
- Visit a string literal.
visitNumberLiteral
public boolean visitNumberLiteral(ExpressionOwner owner,
org.apache.xpath.objects.XNumber num)
- Visit a number literal.