xml

xml#

Tools concerning XML management, simplifying lxml.etree

Functions

add(el, field, value)

Add in place a field to a given element

convert_to_xml(src_ds, attributes)

Convert any dataset containing the given attributes to lxml _Element (i.e. netcdf dataset).

df_to_xml(src_ds)

Convert a pandas.DataFrame or similar (which has a .to_xml() function) to a lxml _Element

dict_to_xml(dict_to_cv[, attributes])

Convert any dict containing the given attributes to a lxml _Element.

read(xml_path)

Read an XML file, even stored on the cloud

read_archive(path[, regex])

Read an XML file from inside an archive (zip or tar) Convenient duplicate of files.read_archived_xml

remove(xml, field)

Remove in place field from a lxml _Element

to_string(xml)

Convert XML root to string

update_attrib(xml, field, attribute, value)

Update in place an attribute of a field with a given value

update_txt(xml, field, value)

Update in place a text of a field

update_txt_fct(xml, field, fct)

Update in place a text of a field by applying a function to the value of the given field

write(xml, path)

Write an Element to disk