read_archived_xml#
- read_archived_xml(archive_path: str | CloudPath | Path, regex: str = None, file_list: list = None, **kwargs) _Element[source]#
Read archived XML from
ziportararchives.You can use this site to build your regex.
- Parameters:
archive_path (AnyPathStrType) – Archive path
regex (str) – XML regex (used by re) as it can be found in the getmembers() list
file_list (list) – List of files contained in the archive. Optional, if not given it will be re-computed.
- 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>