read_archived_xml#
- read_archived_xml(archive_path: str | CloudPath | Path, xml_regex: str) _Element [source]#
Read archived XML from
zip
ortar
archives.You can use this site to build your regex.
- Parameters:
archive_path (AnyPathStrType) – 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
Example
>>> 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>