public abstract class XdmItem extends XdmValue
An item is a member of a sequence, but it can also be considered as a sequence (of length one) in its own right. XdmItem is a subtype of XdmValue because every Item in the XDM data model is also a value.
It cannot be assumed that every sequence of length one will be represented by an XdmItem. It is quite possible for an XdmValue that is not an XdmItem to hold a singleton sequence.
Saxon provides two concrete subclasses of XdmItem, namely
XdmNode and XdmAtomicValue. Users must not attempt to create
additional subclasses.
| Modifier | Constructor and Description |
|---|---|
protected |
XdmItem() |
|
XdmItem(Item<?> item)
Construct an XdmItem as a wrapper around an existing Saxon Item object
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<XdmAtomicValue,XdmValue> |
asMap()
If this item is a map, return a corresponding Java Map.
|
java.lang.String |
getStringValue()
Get the string value of the item.
|
Item<?> |
getUnderlyingValue()
Get the underlying implementation object representing the value.
|
boolean |
isAtomicValue()
Determine whether the item is an atomic value or some other type of item
|
boolean |
matches(ItemType type)
Determine whether this item matches a given item type.
|
int |
size()
Get the number of items in the sequence
|
XdmStream<? extends XdmItem> |
stream()
Get a stream comprising the items in this value
|
protected static XdmAtomicValue |
wrapItem(AtomicValue item) |
protected static XdmItem |
wrapItem(Item<?> item) |
protected static XdmNode |
wrapItem(NodeInfo item) |
append, documentOrder, fromGroundedValue, itemAt, iterator, makeSequence, makeValue, select, setValue, toString, wrap, wrapprotected XdmItem()
public XdmItem(Item<?> item)
item - the Item object to be wrapped. This can be retrieved using the
getUnderlyingValue() method.java.lang.NullPointerException - if item is nullprotected static XdmAtomicValue wrapItem(AtomicValue item)
public Item<?> getUnderlyingValue()
getUnderlyingValue in class XdmValuepublic java.lang.String getStringValue()
For atomic values, the result is the same as the result of calling
toString. This is not the case for nodes, where toString
returns an XML serialization of the node.
public boolean isAtomicValue()
public int size()
public java.util.Map<XdmAtomicValue,XdmValue> asMap()
public boolean matches(ItemType type)
type - the item type to be tested against this itemCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.