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.

get_array_value()

Get the subclass PyXdmArray for this current PyXdmItem object if it is an array item

Returns:

Subclass this object to PyXdmArray or error

Return type:

PyXdmArray

get_atomic_value()

Get the subclass PyXdmAtomicValue for this current PyXdmItem object if it is an atomic value

Returns:

Subclass this object to PyXdmAtomicValue or error

Return type:

PyXdmAtomicValue

get_function_value()

Get the subclass PyXdmFunctionItem for this current PyXdmItem object if it is a function item

Returns:

Subclass this object to PyXdmFunctionItem or error

Return type:

PyXdmFunctionItem

get_map_value()

Get the subclass PyXdmMap for this current PyXdmItem object if it is a map item

Returns:

Subclass this object to PyXdmMap or error

Return type:

PyXdmNode

get_node_value()

Get the subclass PyXdmNode for this current PyXdmItem object if it is a node

Returns:

Subclass this object to PyXdmNode or error

Return type:

PyXdmNode

get_string_value(encoding=None)

Property to get the string value of the item as defined in the XPath data model

Parameters:

encoding (str) – The encoding of the string. If not specified then the platform default encoding is used.

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

Return type:

PyXdmItem

is_array

Property to check if the current PyXdmItem is an array item

Returns:

True if the current item is an array item

Return type:

bool

is_atomic

Property to check if the current PyXdmItem is an atomic value

Returns:

True if the current item is an atomic value

Return type:

bool

is_function

Property to check if the current PyXdmItem is a function item

Returns:

True if the current item is a function item

Return type:

bool

is_map

Property to check if the current PyXdmItem is a map item

Returns:

True if the current item is a map item

Return type:

bool

is_node

Property to check if the current PyXdmItem is a node

Returns:

True if the current item is a node

Return type:

bool

item_at(index)

Get the n’th item in the sequence, counting from zero.

Parameters:

index (int) – the index of the item required, counting from zero

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