Methods Summary |
---|
public void | allowDetachToRelease(boolean allowRelease)Specify if it's OK for detach to release the iterator for reuse.
This function should be called with a value of false for objects that are
stored in variables.
Calling this with a value of false on a XNodeSet will cause the nodeset
to be cached.
|
public void | appendToFsb(com.sun.org.apache.xml.internal.utils.FastStringBuffer fsb)Cast result object to a string.
NEEDSDOC @param fsb
fsb.append(str());
|
public boolean | bool()Cast result object to a boolean. Always issues an error.
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number");
return false;
|
public boolean | boolWithSideEffects()Cast result object to a boolean, but allow side effects, such as the
incrementing of an iterator.
return bool();
|
public void | callVisitors(com.sun.org.apache.xpath.internal.ExpressionOwner owner, com.sun.org.apache.xpath.internal.XPathVisitor visitor)
assertion(false, "callVisitors should not be called for this object!!!");
|
public java.lang.Object | castToType(int t, com.sun.org.apache.xpath.internal.XPathContext support)Cast object to type t.
Object result;
switch (t)
{
case CLASS_STRING :
result = str();
break;
case CLASS_NUMBER :
result = new Double(num());
break;
case CLASS_NODESET :
result = iter();
break;
case CLASS_BOOLEAN :
result = new Boolean(bool());
break;
case CLASS_UNKNOWN :
result = m_obj;
break;
// %TBD% What to do here?
// case CLASS_RTREEFRAG :
// result = rtree(support);
// break;
default :
error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
new Object[]{ getTypeString(),
Integer.toString(t) }); //"Can not convert "+getTypeString()+" to a type#"+t);
result = null;
}
return result;
|
public static com.sun.org.apache.xpath.internal.objects.XObject | create(java.lang.Object val, com.sun.org.apache.xpath.internal.XPathContext xctxt)Create the right XObject based on the type of the object passed.
This function can make an XObject that exposes DOM Nodes, NodeLists, and
NodeIterators to the XSLT stylesheet as node-sets.
return XObjectFactory.create(val, xctxt);
|
public static com.sun.org.apache.xpath.internal.objects.XObject | create(java.lang.Object val)Create the right XObject based on the type of the object passed. This
function can not make an XObject that exposes DOM Nodes, NodeLists, and
NodeIterators to the XSLT stylesheet as node-sets.
return XObjectFactory.create(val);
|
public boolean | deepEquals(com.sun.org.apache.xpath.internal.Expression expr)
if(!isSameClass(expr))
return false;
// If equals at the expression level calls deepEquals, I think we're
// still safe from infinite recursion since this object overrides
// equals. I hope.
if(!this.equals((XObject)expr))
return false;
return true;
|
public void | destruct()Forces the object to release it's resources. This is more harsh than
detach().
if (null != m_obj)
{
allowDetachToRelease(true);
detach();
m_obj = null;
}
|
public void | detach()Detaches the DTMIterator from the set which it iterated
over, releasing any computational resources and placing the iterator
in the INVALID state. After detach has been invoked,
calls to nextNode or previousNode will
raise a runtime exception.
|
public void | dispatchCharactersEvents(org.xml.sax.ContentHandler ch)Directly call the
characters method on the passed ContentHandler for the
string-value. Multiple calls to the
ContentHandler's characters methods may well occur for a single call to
this method.
xstr().dispatchCharactersEvents(ch);
|
public boolean | equals(com.sun.org.apache.xpath.internal.objects.XObject obj2)Tell if two objects are functionally equal.
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.equals(this);
if (null != m_obj)
{
return m_obj.equals(obj2.m_obj);
}
else
{
return obj2.m_obj == null;
}
|
protected void | error(java.lang.String msg)Tell the user of an error, and probably throw an
exception.
error(msg, null);
|
protected void | error(java.lang.String msg, java.lang.Object[] args)Tell the user of an error, and probably throw an
exception.
String fmsg = XSLMessages.createXPATHMessage(msg, args);
// boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR,
// m_support.ERROR,
// null,
// null, fmsg, 0, 0);
// if(shouldThrow)
{
throw new XPathException(fmsg, this);
}
|
public com.sun.org.apache.xpath.internal.objects.XObject | execute(com.sun.org.apache.xpath.internal.XPathContext xctxt)For support of literal objects in xpaths.
return this;
|
public void | fixupVariables(java.util.Vector vars, int globalsSize)XObjects should not normally need to fix up variables.
// no-op
|
public com.sun.org.apache.xpath.internal.objects.XObject | getFresh()Get a fresh copy of the object. For use with variables.
return this;
|
public int | getType()Tell what kind of class this is.
return CLASS_UNKNOWN;
|
public java.lang.String | getTypeString()Given a request type, return the equivalent string.
For diagnostic purposes.
return "#UNKNOWN (" + object().getClass().getName() + ")";
|
public boolean | greaterThan(com.sun.org.apache.xpath.internal.objects.XObject obj2)Tell if one object is greater than the other.
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function. Because the arguments
// are backwards, we call the opposite comparison
// function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.lessThan(this);
return this.num() > obj2.num();
|
public boolean | greaterThanOrEqual(com.sun.org.apache.xpath.internal.objects.XObject obj2)Tell if one object is greater than or equal to the other.
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function. Because the arguments
// are backwards, we call the opposite comparison
// function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.lessThanOrEqual(this);
return this.num() >= obj2.num();
|
public com.sun.org.apache.xml.internal.dtm.DTMIterator | iter()Cast result object to a nodelist. Always issues an error.
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeList!");
return null;
|
public boolean | lessThan(com.sun.org.apache.xpath.internal.objects.XObject obj2)Tell if one object is less than the other.
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function. Because the arguments
// are backwards, we call the opposite comparison
// function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.greaterThan(this);
return this.num() < obj2.num();
|
public boolean | lessThanOrEqual(com.sun.org.apache.xpath.internal.objects.XObject obj2)Tell if one object is less than or equal to the other.
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function. Because the arguments
// are backwards, we call the opposite comparison
// function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.greaterThanOrEqual(this);
return this.num() <= obj2.num();
|
public com.sun.org.apache.xpath.internal.NodeSetDTM | mutableNodeset()Cast result object to a nodelist. Always issues an error.
error(XPATHErrorResources.ER_CANT_CONVERT_TO_MUTABLENODELIST,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeSetDTM!");
return (NodeSetDTM) m_obj;
|
public org.w3c.dom.NodeList | nodelist()Cast result object to a nodelist. Always issues an error.
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeList!");
return null;
|
public org.w3c.dom.traversal.NodeIterator | nodeset()Cast result object to a nodelist. Always issues an error.
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeList!");
return null;
|
public boolean | notEquals(com.sun.org.apache.xpath.internal.objects.XObject obj2)Tell if two objects are functionally not equal.
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.notEquals(this);
return !equals(obj2);
|
public double | num()Cast result object to a number. Always issues an error.
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number");
return 0.0;
|
public double | numWithSideEffects()Cast result object to a number, but allow side effects, such as the
incrementing of an iterator.
return num();
|
public java.lang.Object | object()Return a java object that's closest to the representation
that should be handed to an extension.
return m_obj;
|
public void | reset()Reset for fresh reuse.
|
public int | rtf(com.sun.org.apache.xpath.internal.XPathContext support)Cast result object to a result tree fragment.
int result = rtf();
if (DTM.NULL == result)
{
DTM frag = support.createDocumentFragment();
// %OPT%
frag.appendTextChild(str());
result = frag.getDocument();
}
return result;
|
public int | rtf()For functions to override.
return DTM.NULL;
|
public org.w3c.dom.DocumentFragment | rtree(com.sun.org.apache.xpath.internal.XPathContext support)Cast result object to a result tree fragment.
DocumentFragment docFrag = null;
int result = rtf();
if (DTM.NULL == result)
{
DTM frag = support.createDocumentFragment();
// %OPT%
frag.appendTextChild(str());
docFrag = (DocumentFragment)frag.getNode(frag.getDocument());
}
else
{
DTM frag = support.getDTM(result);
docFrag = (DocumentFragment)frag.getNode(frag.getDocument());
}
return docFrag;
|
public org.w3c.dom.DocumentFragment | rtree()For functions to override.
return null;
|
public java.lang.String | str()Cast result object to a string.
return (m_obj != null) ? m_obj.toString() : "";
|
public java.lang.String | toString()Return the string representation of the object
return str();
|
public com.sun.org.apache.xml.internal.utils.XMLString | xstr()Cast result object to a string.
return XMLStringFactoryImpl.getFactory().newstr(str());
|