read_archived_xml#

read_archived_xml(archive_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], xml_regex: str) lxml.etree._Element[source]#

Read archived XML from zip or tar archives.

You can use this site to build your regex.

>>> arch_path = 'D:/path/to/zip.zip'
>>> file_regex = '.*dir.*file_name'  # Use .* for any character
>>> read_archived_xml(arch_path, file_regex)
<Element LANDSAT_METADATA_FILE at 0x1c90007f8c8>
Parameters
  • archive_path (Union[str, CloudPath, Path]) – Archive path

  • xml_regex (str) – XML regex (used by re) as it can be found in the getmembers() list

Returns

XML file

Return type

etree._Element