Jan-15-2022, 08:03 PM
Im looking for a script what can compare xml and works simular as the compare function in notepad++.
Is there a script like that?
Is there a script like that?
|
XML compare
|
|
Jan-15-2022, 08:03 PM
Im looking for a script what can compare xml and works simular as the compare function in notepad++.
Is there a script like that?
difflib or try some third party like xmldiff.
I can do test with difflib and use rich for better look. from difflib import Differ
from rich import print
with open("1.xml") as f1,open("2.xml") as f2:
f_1 = [i.strip() for i in f1]
f_2 = [i.strip() for i in f2]
diff = Differ()
difference = list(diff.compare(f_1, f_2))
difference = '\n'.join(difference)
print(difference)![]() So it work fine,files used: 1.xml <app> <name>ExtendsClass</name> <type>Web</type> <url>https://python-forum.io</url> <description>Free Online forum</description> </app>2.xml <app> <name>ExtendsClass</name> <type>Web</type> <url>https://vg.no</url> <description>Online forum</description> </app> |
|
|