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:
Cloneable, SourceLocator, PathComponent, ExpressionNode, DTMIterator, XPathVisitable
This class represents an XPath nodeset object, and is capable of converting the nodeset to other
types, such as a string.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final EqualComparatorEqual comparator(package private) static final GreaterThanComparatorGreater than comparator(package private) static final GreaterThanOrEqualComparatorGreater than or equal comparator(package private) static final LessThanComparatorLess than comparator(package private) static final LessThanOrEqualComparatorLess than or equal comparator(package private) static final NotEqualComparatorNot equal comparatorFields inherited from class NodeSequence
m_dtmMgr, m_iter, m_last, m_nextFields inherited from class XObject
CLASS_BOOLEAN, CLASS_NODESET, CLASS_NULL, CLASS_NUMBER, CLASS_RTREEFRAG, CLASS_STRING, CLASS_UNKNOWN, m_objFields inherited from interface DTMIterator
FILTER_ACCEPT, FILTER_SKIP -
Constructor Summary
ConstructorsConstructorDescriptionXNodeSet(DTMIterator val) Construct a XNodeSet object.XNodeSet(DTMManager dtmMgr) Construct an empty XNodeSet object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbool()Cast result object to a boolean.booleanCast 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.booleanTell if two objects are functionally equal.doublegetNumberFromNode(int n) Get numeric value of the string conversion from a single node.getStringFromNode(int n) Get the string conversion from a single node.intgetType()Tell what kind of class this is.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.iter()Cast result object to a nodelist.iterRaw()Return the iterator without cloning, etc.booleanTell if one object is less than the other.booleanlessThanOrEqual(XObject obj2) Tell if one object is less than or equal to the other.Cast result object to a nodelist.nodelist()Cast result object to a nodelist.org.w3c.dom.traversal.NodeIteratornodeset()Cast result object to a nodelist.booleanTell if two objects are functionally not equal.doublenum()Cast result object to a number.doubleCast result object to a number, but allow side effects, such as the incrementing of an iterator.object()Return a java object that's closest to the representation that should be handed to an extension.str()Cast result object to a string.xstr()Cast result object to a string.Methods inherited from class 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, setVectorMethods inherited from class XObject
callVisitors, deepEquals, error, error, execute, toStringMethods inherited from class Expression
asIterator, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, execute, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, num
-
Field Details
-
S_LT
Less than comparator -
S_LTE
Less than or equal comparator -
S_GT
Greater than comparator -
S_GTE
Greater than or equal comparator -
S_EQ
Equal comparator -
S_NEQ
Not equal comparator
-
-
Constructor Details
-
XNodeSet
Construct a XNodeSet object.- Parameters:
val- Value of the XNodeSet object
-
XNodeSet
Construct an empty XNodeSet object. This is used to create a mutable nodeset to which random nodes may be added.
-
-
Method Details
-
getType
-
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
-
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
-
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
Get the string conversion from a single node.- Parameters:
n- Node to convert- Returns:
- the string conversion from a single node.
-
xstr
-
str
-
object
-
nodeset
Cast result object to a nodelist. Always issues an error.- Overrides:
nodesetin classXObject- Returns:
- null
- Throws:
TransformerException- in case of error
-
nodelist
Cast result object to a nodelist. Always issues an error.- Overrides:
nodelistin classXObject- Returns:
- null
- Throws:
TransformerException- in case of error
-
iterRaw
Return the iterator without cloning, etc. -
iter
Cast result object to a nodelist. Always issues an error. -
mutableNodeset
Cast result object to a nodelist. Always issues an error.- Overrides:
mutableNodesetin classXObject- Returns:
- The object as a NodeSetDTM.
-
compare
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:
TransformerException- in case of error
-
lessThan
Tell if one object is less than the other.- Overrides:
lessThanin classXObject- Parameters:
obj2- Object to compare this to- Returns:
- True if this object is less than the given object
- Throws:
TransformerException- in case of error
-
lessThanOrEqual
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:
TransformerException- in case of error
-
greaterThan
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:
TransformerException- in case of error
-
greaterThanOrEqual
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:
TransformerException- in case of error
-
equals
-
notEquals
Tell if two objects are functionally not equal.- Overrides:
notEqualsin classXObject- Parameters:
obj2- Object to compare this to- Returns:
- True if this object is not equal to the given object
- Throws:
TransformerException- in case of error
-