Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import xml.etree.ElementTree as ET
- tree1 = ET.parse(sys.argv[1])
- tree2 = ET.parse(sys.argv[2])
- root1 = tree1.getroot()
- root2 = tree2.getroot()
- dic1 = {}
- dic2 = {}
- for configprop in root1.findall('property'):
- name = configprop.find('name')
- val = configprop.find('value')
- dic1[name.text] = val.text
- #print name.text, val.text
- for configprop in root2.findall('property'):
- name = configprop.find('name')
- val = configprop.find('value')
- dic2[name.text] = val.text
- print ('##Checking Values')
- for entry in dic1:
- try :
- if dic2[entry] == dic1[entry] :
- continue
- else :
- print('DIFF ' + entry + ' Source: ' + dic1[entry] + ' Target: ' + dic2[entry])
- except:
- print('MISS[TARGET] ' + entry + 'Source: ' + dic1[entry] + ' Target: NONE ')
- continue
- dic1keys = set(dic1.keys())
- dic2keys = set(dic2.keys())
- missingSourceKeys = dic2keys.difference(dic1keys)
- for key in missingSourceKeys:
- print('MISS[SOURCE] ' + key + 'Source: NONE ' + 'Target: ' + dic2[key])
Advertisement
Add Comment
Please, Sign In to add comment