|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xpath.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.
Constructor Summary | |
Expression()
|
Method Summary | |
DTMIterator |
asIterator(XPathContext xctxt,
int contextNode)
**Experimental** Given an select expression and a context, evaluate the XPath and return the resulting iterator. |
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. |
void |
error(XPathContext xctxt,
int 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,
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. |
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. |
boolean |
isNodesetExpr()
Tell if the expression is a nodeset expression. |
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 |
setSourceLocator(javax.xml.transform.SourceLocator locator)
Set the location where this expression was built from. |
void |
warn(XPathContext xctxt,
int 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 |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Expression()
Method Detail |
public boolean canTraverseOutsideSubtree()
public void setSourceLocator(javax.xml.transform.SourceLocator locator)
locator
- the location where this expression was built from, may be
null.public XObject execute(XPathContext xctxt, int currentNode) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.currentNode
- The currentNode.XObject
.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
.public abstract XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.XObject
.public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException
public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException
public XMLString xstr(XPathContext xctxt) throws javax.xml.transform.TransformerException
public boolean isNodesetExpr()
public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.public DTMIterator asIterator(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException
xctxt
- The execution context.contextNode
- The node that "." expresses.
NEEDSDOC ($objectName$) @returnpublic 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 handlerXObject
.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 void warn(XPathContext xctxt, int msg, java.lang.Object[] args) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.msg
- An error number that corresponds to one of the numbers 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.public void assertion(boolean b, java.lang.String msg) throws javax.xml.transform.TransformerException
b
- If false, a runtime exception will be thrown.msg
- The assertion message, which should be informative.public void error(XPathContext xctxt, int msg, java.lang.Object[] args) throws javax.xml.transform.TransformerException
xctxt
- The XPath runtime context.msg
- An error number that corresponds to one of the numbers 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |