Saxon.Api
Class XdmItem
- Direct Known Subclasses
- XdmAtomicValue, XdmExternalObject, XdmFunctionItem, XdmNode
-
public abstract class XdmItem
- extends XdmValue
The class XdmItem
represents an item in a sequence, as defined
by the XDM data model. An item may be an atomic value, a node, a function (including
maps
and arrays), or an external object.
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 always be
represented by an XdmItem
. It is quite possible for an XdmValue
that is not an XdmItem
to hold a singleton sequence. Use XdmValue.Simplify
to ensure that a singleton is represented as an XdmItem
.
Property Summary |
|
---|---|
string | StringValue Get the string value of the item. |
Method Summary |
|
---|---|
bool | IsAtomic () Ask whether the item is an atomic value. |
bool | IsNode () Ask whether the item is a node or some other type of item. |
bool | Matches (XdmItemType typei) Ask whether this item matches a given item type. |
static XdmItem | WrapItem (net.sf.saxon.om.Item value)
Create an |
static XdmNode | WrapItem (net.sf.saxon.om.NodeInfo value)
Create an |
static XdmAtomicValue | WrapItem (net.sf.saxon.value.AtomicValue value)
Create an |
Property Detail
StringValue
Get the string value of the item.
- For an atomic value, the result is the same as casting the value to a string.
- For a node, the method returns the string value of the node. This is not the same as the result of XdmNode.ToString, which returns the result of serializing the node.
- For a function, including a map or array, the result is an error.
- For an external object, the result is the same as the result of calling
ToString()
on the external object.
In all cases the result is the same as applying the XPath string()
function.
Returns:
Method Detail
IsAtomic
IsNode
Ask whether the item is a node or some other type of item.
Returns:
Matches
Ask whether this item matches a given item type.
Parameters:
typei
- The item type to be tested against this itemReturns:
WrapItem
Create an XdmItem
from an underlying Saxon Saxon.Hej.om.Item
object.
The result is the same as applying the XdmValue.Wrap
method, but
it is returned more conveniently as an instance of XdmItem
Parameters:
value
- An object representing an XDM value in the
underlying Saxon implementation. Must not be null.Returns:
XdmItem
that wraps the underlying Saxon XDM item
representation.WrapItem
Create an XdmNode
from an underlying Saxon Saxon.Hej.om.NodeInfo
object.
The result is the same as applying the XdmValue.Wrap
method, but
it is returned more conveniently as an instance of XdmNode
Parameters:
value
- An object representing an XDM node in the
underlying Saxon implementation. Must not be null.Returns:
XdmNode
that wraps the underlying Saxon XDM node
representation.WrapItem
Create an XdmAtomicValue
from an underlying Saxon Saxon.Hej.value.AtomicValue
object.
The result is the same as applying the XdmValue.Wrap
method, but
it is returned more conveniently as an instance of XdmAtomicValue
Parameters:
value
- An object representing an XDM atomic value in the
underlying Saxon implementation. Must not be null.Returns:
XdmAtomicValue
that wraps the underlying Saxon atomic value
representation.
Ask whether the item is an atomic value.
Returns: