Saxon.Api

 

 

Saxon.Api

Class XdmItem

Direct Known Subclasses
XdmAtomicValue, XdmExternalObjectValue, 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.

Method Summary

 string GetStringValue()

Get the string value of the item.

 bool IsAtomic()

Determine whether the item is an atomic value

 bool Matches(XdmItemType typei)

Determine whether this item matches a given item type

 

Method Detail

GetStringValue

public string GetStringValue()

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:

The result of converting the item to a string

IsAtomic

public abstract bool IsAtomic()

Determine whether the item is an atomic value

Returns:

true if the item is an atomic value, false if it is a node, function, or external object

Matches

public bool Matches(XdmItemType typei)

Determine whether this item matches a given item type

Parameters:

typei - typei the item type to be tested against this item

Returns:

true if the item matches this item type, false if it does not match.