public interface Item extends GroundedValue
This interface is part of the public Saxon API. As such (starting from Saxon 8.4), methods that form part of the stable API are labelled with a JavaDoc "since" tag to identify the Saxon release at which they were introduced.
Note: there is no method getItemType(). This is to avoid having to implement it on every implementation of NodeInfo. Instead, use the static method Type.getItemType(Item).
| Modifier and Type | Method and Description |
|---|---|
AtomicSequence |
atomize()
Atomize the item.
|
Genre |
getGenre()
Get the genre of this item (to distinguish the top-level categories of item,
such as nodes, atomic values, and functions)
|
default int |
getLength()
Get the size of the value (the number of items)
|
java.lang.String |
getStringValue()
Get the value of the item as a string.
|
java.lang.CharSequence |
getStringValueCS()
Get the string value of the item as a CharSequence.
|
default Item |
head()
Get the first item in the sequence.
|
default boolean |
isStreamed()
Ask whether this is a node in a streamed document
|
default Item |
itemAt(int n)
Get the n'th item in the value, counting from 0
|
default SingletonIterator<? extends Item> |
iterate()
Get an iterator over all the items in the sequence
|
default GroundedValue |
reduce()
Reduce the sequence to its simplest form.
|
default GroundedValue |
subsequence(int start,
int length)
Get a subsequence of the value
|
static GroundedValue |
toGroundedValue(Item item) |
default java.lang.String |
toShortString()
Provide a short string showing the contents of the item, suitable
for use in error messages
|
asIterable, concatenate, containsNode, effectiveBooleanValue, materializemakeRepeatableGenre getGenre()
default Item head()
Sequence in that
* no exception is thrown.head in interface GroundedValuehead in interface Sequencejava.lang.String getStringValue()
If the calling code can handle any CharSequence, the method getStringValueCS() should
be used. If the caller requires a string, this method is preferred.
getStringValue in interface GroundedValuejava.lang.UnsupportedOperationException - if the item is a function item (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValueCS()java.lang.CharSequence getStringValueCS()
X.getStringValueCS().toString() returns a string that is equal to
X.getStringValue().
Note that two CharSequence values of different types should not be compared using equals(), and for the same reason they should not be used as a key in a hash table.
If the calling code can handle any CharSequence, this method should
be used. If the caller requires a string, the getStringValue() method is preferred.
getStringValueCS in interface GroundedValuejava.lang.UnsupportedOperationException - if the item is a function item (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValue()AtomicSequence atomize() throws XPathException
XPathException - if atomization is not allowed
for this kind of itemdefault java.lang.String toShortString()
toShortString in interface GroundedValuedefault Item itemAt(int n)
itemAt in interface GroundedValuen - the index of the required item, with 0 representing the first item in the sequencedefault GroundedValue subsequence(int start, int length)
subsequence in interface GroundedValuestart - the index of the first item to be included in the result, counting from zero.
A negative value is taken as zero. If the value is beyond the end of the sequence, an empty
sequence is returnedlength - the number of items to be included in the result. Specify Integer.MAX_VALUE to
get the subsequence up to the end of the base sequence. If the value is negative, an empty sequence
is returned. If the value goes off the end of the sequence, the result returns items up to the end
of the sequencedefault int getLength()
getLength in interface GroundedValuedefault SingletonIterator<? extends Item> iterate()
iterate in interface GroundedValueiterate in interface Sequencedefault GroundedValue reduce()
reduce in interface GroundedValuestatic GroundedValue toGroundedValue(Item item)
default boolean isStreamed()
Copyright (c) 2004-2021 Saxonica Limited. All rights reserved.