resqpy.olio.xml_etΒΆ

xml_et.py: Resqml xml element tree utilities module.

Functions

bool_from_text

Returns boolean value for string 'true' or 'false'; anything else results in None.

citation_title_for_node

Looks for a citation node as a child of node and returns the title text.

colon_prefixed

Returns a version of an xml tag with {url} prefix replaced with nsi: equivalent; also returns the nsi prefix.

content_type

Returns the actual type, as embedded in an xml ContentType attribute; application and version are disregarded.

count_tag

Returns the number of children in xml node with a (prefix-stripped) tag matching given tag name.

create_metadata_xml

Writes the xml for the given metadata dictionary.

creation_date_for_node

Looks for a citation node as a child of node and returns the creation (date-time) text.

cut_extra_metadata

Removes all the extra metadata children under root node.

cut_nodes_of_types

Deletes any nodes of a type matching one in the given list.

cut_obj_references

Deletes any object reference nodes to uuids in given list.

find_in_ordered_data

Returns the index in the ordered list-like array of value; or None if not present.

find_nested_tags

Follows a list of tags in a nested xml hierarchy, returning the node at the deepest level.

find_nested_tags_bool

Return stripped text of node at deepest level of xml hierarchy as a bool.

find_nested_tags_cast

Return value of nested tags as desired dtype.

find_nested_tags_float

Return stripped text of node at deepest level of xml hierarchy as a float.

find_nested_tags_int

Return stripped text of node at deepest level of xml hierarchy as an int.

find_nested_tags_text

Return stripped text of node at deepest level of xml hierarchy.

find_tag

Finds the first child in xml node with a (prefix-stripped) tag matching given tag name.

find_tag_bool

Finds the first child in xml node with a tag matching given tag name; returns stripped text field as bool.

find_tag_float

Finds the first child in xml node with a tag matching given tag name; returns stripped text field as float.

find_tag_int

Finds the first child in xml node with a tag matching given tag name; returns stripped text field as int.

find_tag_text

Finds the first child in xml node with a tag matching given tag name; returns stripped text field.

ijk_handedness

Returns ijk true handedness as 'left', 'right' or 'unknown'.

is_node

Returns True if type of object is element tree node; False otherwise.

length_units_from_node

Returns standard length units string based on node text, or 'unknown'.

list_obj_references

Returns list of nodes of type DataObjectReference.

list_of_descendant_tag

Returns a list of descendants in xml node tree with a (prefix-stripped) tag matching given tag name.

list_of_tag

Returns a list of children in xml node with a (prefix-stripped) tag matching given tag name.

load_metadata_from_xml

Loads the ExtraMetaData stored in a RESQML part as a dictionary.

match

Returns True if the xml_name stripped of prefix matches name.

node_bool

Returns stripped node text as bool, or None.

node_float

Returns stripped node text as float, or None.

node_int

Returns stripped node text as int, or None.

node_text

Returns stripped node text or 'unknown' if node is None or text is blank or newline.

node_type

Returns the type as held in attributes of xml node; defining authority is stripped out.

part_name_for_object

Returns the standard part name comprised of the object type, uuid and .xml extension.

part_name_for_part_root

Returns the part name given the root node for the part's xml.

patch_uuid_in_part_root

Returns modified part name with uuid swapped to uuid argument; root attrib is also changed.

print_xml_tree

Print an xml tree in an indented semi-readable format; return accumulated number of lines.

rels_part_name_for_part

Returns the paired relationships part name for the given part name.

simplified_data_type

Returns a simplified string version of the elemental data type (typically for a numpy or hdf5 array).

strip_path

Returns the filename part of full_path with any directory path removed.

stripped_of_prefix

Returns a simplified version of an xml tag or other str with any {xsd defining prefix} stripped off.

time_units_from_node

Returns standard time units string based on node text, or 'unknown'.

uuid_for_part_root

Returns uuid as stored in xml attribs for root.

uuid_in_part_name

Returns uuid as embedded in part name.

write_xml

Write an xml tree to file in an indented format; gSOAP/FESAPI compatible; return number of nodes written.

write_xml_node

Recursively write an xml node to an open file; return number of nodes written.

xyz_handedness

Return xyz true handedness as 'left', 'right' or 'unknown'.