Methods Summary |
---|
public com.sun.org.apache.xml.internal.dtm.DTMIterator | asIterator(com.sun.org.apache.xpath.internal.XPathContext xctxt, int contextNode)Given an select expression and a context, evaluate the XPath
and return the resulting iterator.
try
{
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
return execute(xctxt).iter();
}
finally
{
xctxt.popCurrentNodeAndExpression();
}
|
public com.sun.org.apache.xml.internal.dtm.DTMIterator | asIteratorRaw(com.sun.org.apache.xpath.internal.XPathContext xctxt, int contextNode)Given an select expression and a context, evaluate the XPath
and return the resulting iterator, but do not clone.
try
{
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
XNodeSet nodeset = (XNodeSet)execute(xctxt);
return nodeset.iterRaw();
}
finally
{
xctxt.popCurrentNodeAndExpression();
}
|
public int | asNode(com.sun.org.apache.xpath.internal.XPathContext xctxt)Return the first node out of the nodeset, if this expression is
a nodeset expression.
DTMIterator iter = execute(xctxt).iter();
return iter.nextNode();
|
public void | assertion(boolean b, java.lang.String msg)Tell the user of an assertion error, and probably throw an
exception.
if (!b)
{
java.lang.String fMsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
new Object[]{ msg });
throw new RuntimeException(fMsg);
}
|
public boolean | bool(com.sun.org.apache.xpath.internal.XPathContext xctxt)Evaluate expression to a boolean.
return execute(xctxt).bool();
|
public boolean | canTraverseOutsideSubtree()Tell if this expression or it's subexpressions can traverse outside
the current subtree.
return false;
|
public abstract boolean | deepEquals(com.sun.org.apache.xpath.internal.Expression expr)Compare this object with another object and see
if they are equal, include the sub heararchy.
|
public void | error(com.sun.org.apache.xpath.internal.XPathContext xctxt, java.lang.String msg, java.lang.Object[] args)Tell the user of an error, and probably throw an
exception.
java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
if (null != xctxt)
{
ErrorListener eh = xctxt.getErrorListener();
TransformerException te = new TransformerException(fmsg, this);
eh.fatalError(te);
}
|
public com.sun.org.apache.xpath.internal.objects.XObject | execute(com.sun.org.apache.xpath.internal.XPathContext xctxt, int currentNode)Execute an expression in the XPath runtime context, and return the
result of the expression.
// For now, the current node is already pushed.
return execute(xctxt);
|
public com.sun.org.apache.xpath.internal.objects.XObject | execute(com.sun.org.apache.xpath.internal.XPathContext xctxt, int currentNode, com.sun.org.apache.xml.internal.dtm.DTM dtm, int expType)Execute an expression in the XPath runtime context, and return the
result of the expression.
// For now, the current node is already pushed.
return execute(xctxt);
|
public abstract com.sun.org.apache.xpath.internal.objects.XObject | execute(com.sun.org.apache.xpath.internal.XPathContext xctxt)Execute an expression in the XPath runtime context, and return the
result of the expression.
|
public com.sun.org.apache.xpath.internal.objects.XObject | execute(com.sun.org.apache.xpath.internal.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. The default implementation just calls execute(xctxt).
return execute(xctxt);
|
public void | executeCharsToContentHandler(com.sun.org.apache.xpath.internal.XPathContext xctxt, org.xml.sax.ContentHandler handler)Execute an expression in the XPath runtime context, and return the
result of the expression.
XObject obj = execute(xctxt);
obj.dispatchCharactersEvents(handler);
obj.detach();
|
public void | exprAddChild(com.sun.org.apache.xpath.internal.ExpressionNode n, int i)This method tells the node to add its argument to the node's
list of children.
assertion(false, "exprAddChild method not implemented!");
|
public com.sun.org.apache.xpath.internal.ExpressionNode | exprGetChild(int i)This method returns a child node. The children are numbered
from zero, left to right.
return null;
|
public int | exprGetNumChildren()Return the number of children the node has.
return 0;
|
public com.sun.org.apache.xpath.internal.ExpressionNode | exprGetParent()
return m_parent;
|
public void | exprSetParent(com.sun.org.apache.xpath.internal.ExpressionNode n)This pair of methods are used to inform the node of its
parent.
assertion(n != this, "Can not parent an expression to itself!");
m_parent = n;
|
public 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.
|
public int | getColumnNumber()Return the character position where the current document event ends.
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.
if(null == m_parent)
return 0;
return m_parent.getColumnNumber();
|
public com.sun.org.apache.xpath.internal.ExpressionNode | getExpressionOwner()Get the first non-Expression parent of this node.
ExpressionNode parent = exprGetParent();
while((null != parent) && (parent instanceof Expression))
parent = parent.exprGetParent();
return parent;
|
public int | getLineNumber()Return the line number where the current document event ends.
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.
if(null == m_parent)
return 0;
return m_parent.getLineNumber();
|
public java.lang.String | getPublicId()Return the public identifier for the current document event.
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.
if(null == m_parent)
return null;
return m_parent.getPublicId();
|
public java.lang.String | getSystemId()Return the system identifier for the current document event.
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.
if(null == m_parent)
return null;
return m_parent.getSystemId();
|
public boolean | isNodesetExpr()Tell if the expression is a nodeset expression. In other words, tell
if you can execute {@link asNode() asNode} without an exception.
return false;
|
protected final boolean | isSameClass(com.sun.org.apache.xpath.internal.Expression expr)This is a utility method to tell if the passed in
class is the same class as this. It is to be used by
the deepEquals method. I'm bottlenecking it here
because I'm not totally confident that comparing the
class objects is the best way to do this.
if(null == expr)
return false;
return (getClass() == expr.getClass());
|
public boolean | isStableNumber()Tell if this expression returns a stable number that will not change during
iterations within the expression. This is used to determine if a proximity
position predicate can indicate that no more searching has to occur.
return false;
|
public double | num(com.sun.org.apache.xpath.internal.XPathContext xctxt)Evaluate expression to a number.
return execute(xctxt).num();
|
public void | warn(com.sun.org.apache.xpath.internal.XPathContext xctxt, java.lang.String msg, java.lang.Object[] args)Warn the user of an problem.
java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args);
if (null != xctxt)
{
ErrorListener eh = xctxt.getErrorListener();
// TO DO: Need to get stylesheet Locator from here.
eh.warning(new TransformerException(fmsg, xctxt.getSAXLocator()));
}
|
public com.sun.org.apache.xml.internal.utils.XMLString | xstr(com.sun.org.apache.xpath.internal.XPathContext xctxt)Cast result object to a string.
return execute(xctxt).xstr();
|