Python XML to Dict parser
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Looking for some python 3.x to parse the XML in the link below, specifically need to iterate over tags. The actual xml files are over 400mb and contain thousands of and have many more tags under and many more
I would like something similar to:

import xmltodict

x_file = 'afile.xml'

with open(x_file) as fd:

doc = xmltodict.parse(fd.read())

for item in doc.items():

print(item)

This would generate something like for each item:

{ 'title': "title a", 'project':"12345" ..... }

xml extract: https://pastebin.com/5rj54xRe

Thanks!

Tags
xml
python3

Crowdsource coding tasks.

1 Solution

Winning solution

Solution

Hello broadreach,

Here is the code for your specification.
An example output can be found here.

Thank you,
Vladimir

Thanks Vladimir, elegant solution as usual!
broadreach 24 days ago
Thank you! Happy to hear that you are satisfied with the solution!
VladimirMikulic 24 days ago
View Timeline