summaryrefslogtreecommitdiffstats
path: root/scripts/compare_xml.py
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-01-29 23:37:37 +0100
committerEthan Yonker <dees_troy@teamw.in>2016-01-30 05:53:48 +0100
commit9ee045a21c661dc38696b8425419cbbc32d8e85c (patch)
tree8e3bbf83de028c5da291c93dd7c4fa1e18bbf073 /scripts/compare_xml.py
parentRemove execute permissions from source files (diff)
downloadandroid_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.tar
android_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.tar.gz
android_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.tar.bz2
android_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.tar.lz
android_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.tar.xz
android_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.tar.zst
android_bootable_recovery-9ee045a21c661dc38696b8425419cbbc32d8e85c.zip
Diffstat (limited to 'scripts/compare_xml.py')
-rw-r--r--scripts/compare_xml.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/scripts/compare_xml.py b/scripts/compare_xml.py
new file mode 100644
index 000000000..bec41c03a
--- /dev/null
+++ b/scripts/compare_xml.py
@@ -0,0 +1,62 @@
+from xml.dom import minidom
+import sys
+import getopt
+
+HELP = """
+ compare_xml.py [ -o file.xml ]
+ -f file.xml
+ -h - help info
+"""
+
+enfile = "en.xml"
+otherfile = ""
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "hfo:koz", ["device="])
+except getopt.GetoptEror:
+ print HELP
+ sys.stdout.flush()
+ sys.exit(2)
+
+for opt, arg in opts:
+ if opt == "-h":
+ print HELP
+ sys.stdout.flush()
+ sys.exit()
+ elif opt == "-o":
+ otherfile = arg
+ elif opt == "-f":
+ enfile = arg
+
+if otherfile == "":
+ print HELP
+ exit()
+
+print "Comparing %s and %s" % (enfile, otherfile)
+print ""
+
+endoc = minidom.parse(enfile)
+enstrings = endoc.getElementsByTagName('string')
+
+otherdoc = minidom.parse(otherfile)
+otherstrings = otherdoc.getElementsByTagName('string')
+
+for ens in enstrings:
+ found = False
+ for others in otherstrings:
+ if ens.attributes['name'].value == others.attributes['name'].value:
+ found = True
+ break
+ if found == False:
+ print "'%s' present in %s and not in %s" % (ens.attributes['name'].value, enfile, otherfile)
+
+print ""
+
+for others in otherstrings:
+ found = False
+ for ens in enstrings:
+ if ens.attributes['name'].value == others.attributes['name'].value:
+ found = True
+ break
+ if found == False:
+ print "'%s' present in %s and not in %s" % (others.attributes['name'].value, otherfile, enfile)