|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xpath.Expression
public abstract class Expression
This abstract class serves as the base for all expression objects. An
Expression can be executed to return a XObject
,
normally has a location within a document or DOM, can send error and warning
events, and normally do not hold state and are meant to be immutable once
construction has completed. An exception to the immutibility rule is iterators
and walkers, which must be cloned in order to be used -- the original must
still be immutable.
Field Summary | |
---|---|
private ExpressionNode |
m_parent
The location where this expression was built from. |
(package private) static long |
serialVersionUID
|
Constructor Summary | |
---|---|
Expression()
|
Method Summary | |
---|---|
DTMIterator |
asIterator(XPathContext xctxt,
int contextNode)
Given an select expression and a context, evaluate the XPath and return the resulting iterator. |
DTMIterator |
asIteratorRaw(XPathContext xctxt,
int contextNode)
Given an select expression and a context, evaluate the XPath and return the resulting iterator, but do not clone. |
int |
asNode(XPathContext xctxt)
Return the first node out of the nodeset, if this expression is a nodeset expression. |
void |
assertion(boolean b,
java.lang.String msg)
Tell the user of an assertion error, and probably throw an exception. |
boolean |
bool(XPathContext xctxt)
Evaluate expression to a boolean. |
boolean |
canTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree. |
abstract boolean |
deepEquals(Expression expr)
Compare this object with another object and see if they are equal, include the sub heararchy. |
void |
error(XPathContext xctxt,
java.lang.String msg,
java.lang.Object[] args)
Tell the user of an error, and probably throw an exception. |
abstract XObject |
execute(XPathContext xctxt)
Execute an expression in the XPath runtime context, and return the result of the expression. |
XObject |
execute(XPathContext xctxt,
boolean destructiveOK)
Execute an expression in the XPath runtime context, and return the result of the expression, but tell that a "safe" object doesn't have to be returned. |
XObject |
execute(XPathContext xctxt,
int currentNode)
Execute an expression in the XPath runtime context, and return the result of the expression. |
XObject |
execute(XPathContext xctxt,
int currentNode,
DTM dtm,
int expType)
Execute an expression in the XPath runtime context, and return the result of the expression. |
void |
executeCharsToContentHandler(XPathContext xctxt,
org.xml.sax.ContentHandler handler)
Execute an expression in the XPath runtime context, and return the result of the expression. |
void |
exprAddChild(ExpressionNode n,
int i)
This method tells the node to add its argument to the node's list of children. |
ExpressionNode |
exprGetChild(int i)
This method returns a child node. |
int |
exprGetNumChildren()
Return the number of children the node has. |
ExpressionNode |
exprGetParent()
|
void |
exprSetParent(ExpressionNode n)
This pair of methods are used to inform the node of its parent. |
abstract void |
fixupVariables(java.util.Vector vars,
int globalsSize)
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. |
int |
getColumnNumber()
Return the character position where the current document event ends. |
ExpressionNode |
getExpressionOwner()
Get the first non-Expression parent of this node. |
int |
getLineNumber()
Return the line number where the current document event ends. |
java.lang.String |
getPublicId()
Return the public identifier for the current document event. |
java.lang.String |
getSystemId()
Return the system identifier for the current document event. |
boolean |
isNodesetExpr()
Tell if the expression is a nodeset expression. |
protected boolean |
isSameClass(Expression expr)
This is a utility method to tell if the passed in class is the same class as this. |
boolean |
isStableNumber()
Tell if this expression returns a stable number that will not change during iterations within the expression. |
double |
num(XPathContext xctxt)
Evaluate expression to a number. |
void |
warn(XPathContext xctxt,
java.lang.String msg,
java.lang.Object[] args)
Warn the user of an problem. |
XMLString |
xstr(XPathContext xctxt)
Cast result object to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.xpath.XPathVisitable |
---|
callVisitors |
Field Detail |
---|
static final long serialVersionUID
private ExpressionNode m_parent
Constructor Detail |
---|
public Expression()
Method Detail |
---|
public boolean canTraverseOutsideSubtree()
public XObject execute(XPathContext xctxt, int currentNode) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.currentNode
- The currentNode.
XObject
.
javax.xml.transform.TransformerException
- if a runtime exception
occurs.public XObject execute(XPathContext xctxt, int currentNode, DTM dtm, int expType) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.currentNode
- The currentNode.dtm
- The DTM of the current node.expType
- The expanded type ID of the current node.
XObject
.
javax.xml.transform.TransformerException
- if a runtime exception
occurs.public abstract XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.
XObject
.
javax.xml.transform.TransformerException
- if a runtime exception
occurs.public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.destructiveOK
- true if a "safe" object doesn't need to be returned.
XObject
.
javax.xml.transform.TransformerException
- if a runtime exception
occurs.public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.
javax.xml.transform.TransformerException
public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.
javax.xml.transform.TransformerException
public XMLString xstr(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.
javax.xml.transform.TransformerException
public boolean isNodesetExpr()
asNode
without an exception.
public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.
javax.xml.transform.TransformerException
public DTMIterator asIterator(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException
xctxt
- The execution context.contextNode
- The node that "." expresses.
javax.xml.transform.TransformerException
- thrown if the active ProblemListener decides
the error condition is severe enough to halt processing.
javax.xml.transform.TransformerException
public DTMIterator asIteratorRaw(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException
xctxt
- The execution context.contextNode
- The node that "." expresses.
javax.xml.transform.TransformerException
- thrown if the active ProblemListener decides
the error condition is severe enough to halt processing.
javax.xml.transform.TransformerException
public void executeCharsToContentHandler(XPathContext xctxt, org.xml.sax.ContentHandler handler) throws javax.xml.transform.TransformerException, org.xml.sax.SAXException
xctxt
- The XPath runtime context.
NEEDSDOC @param handler
javax.xml.transform.TransformerException
- if a runtime exception
occurs.
org.xml.sax.SAXException
public boolean isStableNumber()
public abstract void fixupVariables(java.util.Vector vars, int globalsSize)
vars
- List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame).
NEEDSDOC @param globalsSizepublic abstract boolean deepEquals(Expression expr)
expr
- Another expression object.
protected final boolean isSameClass(Expression expr)
public void warn(XPathContext xctxt, java.lang.String msg, java.lang.Object[] args) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.msg
- An error msgkey that corresponds to one of the conststants found
in XPATHErrorResources
, which is
a key for a format string.args
- An array of arguments represented in the format string, which
may be null.
javax.xml.transform.TransformerException
- if the current ErrorListoner determines to
throw an exception.
javax.xml.transform.TransformerException
public void assertion(boolean b, java.lang.String msg)
b
- If false, a runtime exception will be thrown.msg
- The assertion message, which should be informative.
java.lang.RuntimeException
- if the b argument is false.
javax.xml.transform.TransformerException
public void error(XPathContext xctxt, java.lang.String msg, java.lang.Object[] args) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.msg
- An error msgkey that corresponds to one of the constants found
in XPATHErrorResources
, which is
a key for a format string.args
- An array of arguments represented in the format string, which
may be null.
javax.xml.transform.TransformerException
- if the current ErrorListoner determines to
throw an exception.
javax.xml.transform.TransformerException
public ExpressionNode getExpressionOwner()
public void exprSetParent(ExpressionNode n)
exprSetParent
in interface ExpressionNode
public ExpressionNode exprGetParent()
exprGetParent
in interface ExpressionNode
public void exprAddChild(ExpressionNode n, int i)
exprAddChild
in interface ExpressionNode
public ExpressionNode exprGetChild(int i)
exprGetChild
in interface ExpressionNode
public int exprGetNumChildren()
exprGetNumChildren
in interface ExpressionNode
public java.lang.String getPublicId()
The return value is the public identifier of the document entity or of the external parsed entity in which the markup that triggered the event appears.
getPublicId
in interface javax.xml.transform.SourceLocator
getSystemId()
public java.lang.String getSystemId()
The return value is the system identifier of the document entity or of the external parsed entity in which the markup that triggered the event appears.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
getSystemId
in interface javax.xml.transform.SourceLocator
getPublicId()
public int getLineNumber()
Warning: The return value from the method is intended only as an approximation for the sake of error reporting; it is not intended to provide sufficient information to edit the character content of the original XML document.
The return value is an approximation of the line number in the document entity or external parsed entity where the markup that triggered the event appears.
getLineNumber
in interface javax.xml.transform.SourceLocator
getColumnNumber()
public int getColumnNumber()
Warning: The return value from the method is intended only as an approximation for the sake of error reporting; it is not intended to provide sufficient information to edit the character content of the original XML document.
The return value is an approximation of the column number in the document entity or external parsed entity where the markup that triggered the event appears.
getColumnNumber
in interface javax.xml.transform.SourceLocator
getLineNumber()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |