The new forums will be named Coin Return (based on the most recent
vote)! You can check on the status and timeline of the transition to the new forums
here.
The Guiding Principles and New Rules
document is now in effect.
Compare two XML files preferably using Python
I need to compare two XML files having same structure for any extra lines. Below example provides some details:
File 1:
<Log1> Some text here </Log1>
<Log2>
<Id1> Some text here </Id1>
<Id2> Some text here </Id2>
</Log2>
File2:
<Log1> Some text here </Log1>
<Log2>
<Id1> Some text here </Id1>
<Id2> Some text here </Id2>
</Log2>
<Log3> Some text here </Log3>
I need the diff to identify here that there is one extra tag in File2. Is there an efficient to do this in Python?
0
Posts
Unless your element tags are actually suffixed 1,2,3; but then you just need to iterate through the children and count the tags yourself; which should be pretty straightforward.
Instead of soliciting direct advice, you should start here:
https://www.google.com/search?q=python+diff+xml
Because, as a discipline, learning to use google is second only to learning to use a debugger; and I would recommend you master both.
If you can't find someone, somewhere, discussing a problem/challenge similar to the one you're experiencing, then you've either made a brilliant innovation, a fundamental misstep, or a typo.
Note: Be aware that your teacher definitely knows how to google, and will treat you unkindly if you just copy stuff off of stack overflow