PyXdmItem

class PyXdmItem

Bases: PyXdmValue

The class PyXdmItem represents an item in a sequence, as defined by the XDM data model. An item is either an atomic value, a node, or a function item.

Creates a new instance, keeping a reference to its PySaxonProcessor :param processor:

classmethod __new__(*args, **kwargs)
__pyx_vtable__ = <capsule object NULL>
__reduce__()

Helper for pickle.

__repr__()

Return repr(self).

__setstate__()
__str__()

Return str(self).

get_array_value(self)

Get the subclass PyXdmArray for this current PyXdmItem object if it is an array item :returns: Subclass this object to PyXdmArray or error :rtype: PyXdmArray

get_atomic_value(self)

Get the subclass PyXdmAtomicValue for this current PyXdmItem object if it is an atomic value :returns: Subclass this object to PyXdmAtomicValue or error :rtype: PyXdmAtomicValue

get_function_value(self)

Get the subclass PyXdmFunctionItem for this current PyXdmItem object if it is a function item :returns: Subclass this object to PyXdmFunctionItem or error :rtype: PyXdmFunctionItem

get_map_value(self)

Get the subclass PyXdmMap for this current PyXdmItem object if it is a map item :returns: Subclass this object to PyXdmMap or error :rtype: PyXdmNode

get_node_value(self)

Get the subclass PyXdmNode for this current PyXdmItem object if it is a node :returns: Subclass this object to PyXdmNode or error :rtype: PyXdmNode

get_string_value(self, encoding=None)

Property to get the string value of the item as defined in the XPath data model :param encoding: The encoding of the string. If not specified then the platform default encoding is used. :type encoding: str

Returns:

The string value of this node

Return type:

str

head

Property to get the first item in the sequence represented by this PyXdmItem. Since a PyXdmItem is a sequence of length one, this returns the PyXdmItem itself. :returns: The PyXdmItem or None if the sequence is empty :rtype: PyXdmItem

is_array

Property to check if the current PyXdmItem is an array item :returns: True if the current item is an array item :rtype: bool

is_atomic

Property to check if the current PyXdmItem is an atomic value :returns: True if the current item is an atomic value :rtype: bool

is_function

Property to check if the current PyXdmItem is a function item :returns: True if the current item is a function item :rtype: bool

is_map

Property to check if the current PyXdmItem is a map item :returns: True if the current item is a map item :rtype: bool

is_node

Property to check if the current PyXdmItem is a node :returns: True if the current item is a node :rtype: bool

item_at(self, index)

Get the n’th item in the sequence, counting from zero. :param index: the index of the item required, counting from zero :type index: int

Returns:

The item at the specified index. This could be a PyXdmItem or any of its subclasses: PyXdmAtomicValue, PyXdmNode, PyXdmFunctionItem, PyXdmMap or PyXdmArray. If the item does not exist returns None.

Return type:

PyXdmItem

string_value

Property to get the string value of the PyXdmItem