Reputation: 35
I'm working on a project where I need to detect changes in two XML files, generated at different times.
The XML files contain airport data, runways, obstacles etc. so a lot of nested information, and only a fraction of the airports in the file are relevant.
I've tried the xmldiff module but it takes a long time to run and obviously returns information not relevant to the airports I'm interested in.
I've decided to write a python script to extract only the airports I need from the XML's, and store the data in two separate dictionaries, I will then compare them and try to identify the changes.
Could anyone advise on whether this is the correct way to go about the problem? Any advice at all is much appreciated!
Thanks
Upvotes: 0
Views: 372
Reputation: 1259
Extracting the airports and saving them in a data structure that you can compare feels like a good way to approach the problem to me. Depending on how you handle duplicates you could think about using dictionaries (one key - multiple values) or sets (no duplicates). Here is a pretty good explanation on how to compare the contents of two different sets.
Upvotes: 2