algebraixlib.import_export.xml module

Import data from XML.

algebraixlib.import_export.xml.import_xml()[source]

Import the file xml_file_or_filepath as XML file and return nested relations.

Parameters:
  • xml_file_or_filepath – A file path or a file object of the file to be imported.
  • convert_numerics – If True, numeric values (integers, floating-point numbers) are imported as number types. If False (default), everything is imported as string.
Returns:

A nested relation starting with a relation that contains a single couplet that represents the single XML root element.

algebraixlib.import_export.xml.xml_to_str(xml_file_or_filepath, indent_text=' ', truncate=True, max_line_len=95, pre_len=0, post_len=0)[source]

Return an XML file or string into a consistently formatted XML string.

Parameters:
  • xml_file_or_filepath – A file path or a file object to be converted.
  • indent_text – A string of characters used as indent.
  • truncate – When True, truncate converted text using max_line_len.
  • max_line_len – The maximum number of characters per line when truncation is used.
  • pre_len – The maximum length, in characters, the first part of the converted string is allowed to be. (The part between pre_len and post_len is replaced with a line that contains an ellipsis.) Ignored if 0 or if post_len is 0.
  • post_len – The maximum length, in characters, the last part of the converted string is allowed to be. (The part between pre_len and post_len is replaced with a line that contains an ellipsis.) Ignored if 0 or if pre_len is 0.