Package org.htmlunit.xpath.objects
Class XNodeSet
- java.lang.Object
-
- org.htmlunit.xpath.Expression
-
- org.htmlunit.xpath.objects.XObject
-
- org.htmlunit.xpath.axes.NodeSequence
-
- org.htmlunit.xpath.objects.XNodeSet
-
- All Implemented Interfaces:
java.lang.Cloneable,javax.xml.transform.SourceLocator,PathComponent,ExpressionNode,DTMIterator,XPathVisitable
public class XNodeSet extends NodeSequence
This class represents an XPath nodeset object, and is capable of converting the nodeset to other types, such as a string.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static EqualComparatorS_EQEqual comparator(package private) static GreaterThanComparatorS_GTGreater than comparator(package private) static GreaterThanOrEqualComparatorS_GTEGreater than or equal comparator(package private) static LessThanComparatorS_LTLess than comparator(package private) static LessThanOrEqualComparatorS_LTELess than or equal comparator(package private) static NotEqualComparatorS_NEQNot equal comparator-
Fields inherited from class org.htmlunit.xpath.axes.NodeSequence
m_dtmMgr, m_iter, m_last, m_next
-
Fields inherited from class org.htmlunit.xpath.objects.XObject
CLASS_BOOLEAN, CLASS_NODESET, CLASS_NULL, CLASS_NUMBER, CLASS_RTREEFRAG, CLASS_STRING, CLASS_UNKNOWN, m_obj
-
Fields inherited from interface org.htmlunit.xpath.xml.dtm.DTMIterator
FILTER_ACCEPT, FILTER_SKIP
-
-
Constructor Summary
Constructors Constructor Description XNodeSet(DTMIterator val)Construct a XNodeSet object.XNodeSet(DTMManager dtmMgr)Construct an empty XNodeSet object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbool()Cast result object to a boolean.booleanboolWithSideEffects()Cast result object to a boolean, but allow side effects, such as the incrementing of an iterator.booleancompare(XObject obj2, Comparator comparator)Tell if one object is less than the other.booleanequals(XObject obj2)Tell if two objects are functionally equal.doublegetNumberFromNode(int n)Get numeric value of the string conversion from a single node.XStringgetStringFromNode(int n)Get the string conversion from a single node.intgetType()Tell what kind of class this is.java.lang.StringgetTypeString()Given a request type, return the equivalent string.booleangreaterThan(XObject obj2)Tell if one object is greater than the other.booleangreaterThanOrEqual(XObject obj2)Tell if one object is greater than or equal to the other.DTMIteratoriter()Cast result object to a nodelist.DTMIteratoriterRaw()Return the iterator without cloning, etc.booleanlessThan(XObject obj2)Tell if one object is less than the other.booleanlessThanOrEqual(XObject obj2)Tell if one object is less than or equal to the other.NodeSetDTMmutableNodeset()Cast result object to a nodelist.org.w3c.dom.NodeListnodelist()Cast result object to a nodelist.org.w3c.dom.traversal.NodeIteratornodeset()Cast result object to a nodelist.booleannotEquals(XObject obj2)Tell if two objects are functionally not equal.doublenum()Cast result object to a number.doublenumWithSideEffects()Cast result object to a number, but allow side effects, such as the incrementing of an iterator.java.lang.Objectobject()Return a java object that's closest to the representation that should be handed to an extension.java.lang.Stringstr()Cast result object to a string.XStringxstr()Cast result object to a string.-
Methods inherited from class org.htmlunit.xpath.axes.NodeSequence
addNodeInDocOrder, clone, cloneWithReset, detach, getAnalysisBits, getAxis, getCurrentNode, getCurrentPos, getDTM, getDTMManager, getExpandEntityReferences, getIteratorCache, getLength, getRoot, getVector, getWhatToShow, hasCache, isDocOrdered, isFresh, item, nextNode, previousNode, reset, runTo, setCurrentPos, setIter, setObject, setRoot, setShouldCacheNodes, setVector
-
Methods inherited from class org.htmlunit.xpath.objects.XObject
callVisitors, deepEquals, error, error, execute, toString
-
Methods inherited from class org.htmlunit.xpath.Expression
asIterator, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, execute, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, num
-
-
-
-
Field Detail
-
S_LT
static final LessThanComparator S_LT
Less than comparator
-
S_LTE
static final LessThanOrEqualComparator S_LTE
Less than or equal comparator
-
S_GT
static final GreaterThanComparator S_GT
Greater than comparator
-
S_GTE
static final GreaterThanOrEqualComparator S_GTE
Greater than or equal comparator
-
S_EQ
static final EqualComparator S_EQ
Equal comparator
-
S_NEQ
static final NotEqualComparator S_NEQ
Not equal comparator
-
-
Constructor Detail
-
XNodeSet
public XNodeSet(DTMIterator val)
Construct a XNodeSet object.- Parameters:
val- Value of the XNodeSet object
-
XNodeSet
public XNodeSet(DTMManager dtmMgr)
Construct an empty XNodeSet object. This is used to create a mutable nodeset to which random nodes may be added.
-
-
Method Detail
-
getType
public int getType()
Tell what kind of class this is.
-
getTypeString
public java.lang.String getTypeString()
Given a request type, return the equivalent string. For diagnostic purposes.- Overrides:
getTypeStringin classXObject- Returns:
- type string "#UNKNOWN" + object class name
-
getNumberFromNode
public double getNumberFromNode(int n)
Get numeric value of the string conversion from a single node.- Parameters:
n- Node to convert- Returns:
- numeric value of the string conversion from a single node.
-
num
public double num()
Cast result object to a number. Always issues an error.
-
numWithSideEffects
public double numWithSideEffects()
Cast result object to a number, but allow side effects, such as the incrementing of an iterator.- Overrides:
numWithSideEffectsin classXObject- Returns:
- numeric value of the string conversion from the next node in the NodeSetDTM, or NAN if no node was found
-
bool
public boolean bool()
Cast result object to a boolean. Always issues an error.
-
boolWithSideEffects
public boolean boolWithSideEffects()
Cast result object to a boolean, but allow side effects, such as the incrementing of an iterator.- Overrides:
boolWithSideEffectsin classXObject- Returns:
- True if there is a next node in the nodeset
-
getStringFromNode
public XString getStringFromNode(int n)
Get the string conversion from a single node.- Parameters:
n- Node to convert- Returns:
- the string conversion from a single node.
-
xstr
public XString xstr()
Cast result object to a string.
-
str
public java.lang.String str()
Cast result object to a string.
-
object
public java.lang.Object object()
Return a java object that's closest to the representation that should be handed to an extension.
-
nodeset
public org.w3c.dom.traversal.NodeIterator nodeset() throws javax.xml.transform.TransformerExceptionCast result object to a nodelist. Always issues an error.
-
nodelist
public org.w3c.dom.NodeList nodelist() throws javax.xml.transform.TransformerExceptionCast result object to a nodelist. Always issues an error.
-
iterRaw
public DTMIterator iterRaw()
Return the iterator without cloning, etc.
-
iter
public DTMIterator iter()
Cast result object to a nodelist. Always issues an error.
-
mutableNodeset
public NodeSetDTM mutableNodeset()
Cast result object to a nodelist. Always issues an error.- Overrides:
mutableNodesetin classXObject- Returns:
- The object as a NodeSetDTM.
-
compare
public boolean compare(XObject obj2, Comparator comparator) throws javax.xml.transform.TransformerException
Tell if one object is less than the other.- Parameters:
obj2- Object to compare this nodeset tocomparator- Comparator to use- Returns:
- See the comments below for each object type comparison
- Throws:
javax.xml.transform.TransformerException- in case of error
-
lessThan
public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException
Tell if one object is less than the other.
-
lessThanOrEqual
public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException
Tell if one object is less than or equal to the other.- Overrides:
lessThanOrEqualin classXObject- Parameters:
obj2- Object to compare this to- Returns:
- True if this object is less than or equal to the given object
- Throws:
javax.xml.transform.TransformerException- in case of error
-
greaterThan
public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException
Tell if one object is greater than the other.- Overrides:
greaterThanin classXObject- Parameters:
obj2- Object to compare this to- Returns:
- True if this object is greater than the given object
- Throws:
javax.xml.transform.TransformerException- in case of error
-
greaterThanOrEqual
public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException
Tell if one object is greater than or equal to the other.- Overrides:
greaterThanOrEqualin classXObject- Parameters:
obj2- Object to compare this to- Returns:
- True if this object is greater than or equal to the given object
- Throws:
javax.xml.transform.TransformerException- in case of error
-
equals
public boolean equals(XObject obj2)
Tell if two objects are functionally equal.
-
notEquals
public boolean notEquals(XObject obj2) throws javax.xml.transform.TransformerException
Tell if two objects are functionally not equal.
-
-