Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML files containing a XML Namespace cannot be parsed #2

Open
schmueller opened this issue Aug 28, 2024 · 0 comments
Open

XML files containing a XML Namespace cannot be parsed #2

schmueller opened this issue Aug 28, 2024 · 0 comments

Comments

@schmueller
Copy link

schmueller commented Aug 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant