PyXdmArray

class PyXdmArray

Bases: PyXdmFunctionItem

The class PyXdmArray represents an array in the XDM data model. An array is a list of zero or more members, each of which is an arbitrary XDM value. The array itself is an XDM item. A PyXdmArray is immutable.

__iter__()

Returns the Iterator object of PyXdmArray

add_member(value)

Append a new member to an array.

Parameters:

value (PyXdmValue) – the new member

Returns:

a new array, one item longer than the original

Return type:

PyXdmArray

arity

Get the arity of the function

Returns:

the arity of the function, that is, the number of arguments in the function’s signature

Return type:

int

array_length

Get the number of members in the array

Returns:

the number of members in the array. (Note that the size() method returns 1 (one), because an XDM array is an item.)

Return type:

int

as_list()

Get the members of the array in the form of a list.

Returns:

list of the members of this array

Return type:

list

concat(value)

Concatenate another array to this array

Parameters:

value (PyXdmArray) – the other array

Returns:

a new array, containing the members of this array followed by the members of the other array

Return type:

PyXdmArray

get(n)

Get the n’th member in the array, counting from zero

Parameters:

n (int) – the member that is required, counting the first member in the array as member zero

Returns:

the n’th member in the sequence making up the array, counting from zero

Return type:

PyXdmValue

put(n, value)

Create a new array in which one member is replaced with a new value.

Parameters:
  • n (int) – n the position of the member that is to be replaced, counting the first member in the array as member zero

  • value (PyXdmValue) – the new value for this member

Returns:

a new array, the same length as the original, with one member replaced by a new value

Return type:

PyXdmArray

string_value

Property to get the string value of the PyXdmArray

Returns:

String value of the array item

Return type:

str