def arrayToXml(self, arr):
xml = ['']
for k, v in arr.iteritems():
if v.isdigit():
xml.append('<{0}>{1}</{0}>'.format(k, v))
else:
xml.append('<{0}></{0}>'.format(k, v))
xml.append('')
return ''.join(xml)
def xmlToArray(xml):
array_data = {}
root = ET.fromstring(xml)
for child in root:
value = child.text
array_data[child.tag] = value
return array_data