read_archive#

read_archive(path: Union[str, pathlib.Path, cloudpathlib.cloudpath.CloudPath], regex: Optional[str] = None) lxml.etree._Element[source]#

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

Manages two cases: - complete path to an XML file stored inside an archive. In this case the filetree from inside the archive should be separated with a !. Don’t need to start with zip or tar - path to the archive plus a regex looking inside the archive. Duplicate behaviour to files.read_archived_xml

Parameters
  • path (Union[str, Path, CloudPath]) – Path to the XML file, stored inside an archive or path to the archive itself

  • regex (str) – Optional. If specified, the path should be the archive path and the regex should be the key to find the XML file inside the archive.

Returns

XML Root

Return type

_Element