Skip to content

XML files containing a XML Namespace cannot be parsed #2

Open
@schmueller

Description

@schmueller

The DMARC Reports from eg. web.de and gmx.de contain a XML Namespace declarated in the feedback-tag:

These XML files cannot be parsed by the script.
I've added the following at line 56 to remove the namespace if existend:

        # If the XML contains a xmlns Namespace, remove it
        try:
           for elem in xml.iter():
              tag_elements = elem.tag.split("}")
              elem.tag = tag_elements[1]
              elem.attrib.clear()
        except:
            pass

The code tries to split up the XML element at the closing bracket of the namespace. If one is existend the namespace is removed, if non is existend, an error accures, which let's it jump to the except: statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions