in mns/mns_xml_handler.py [0:0]
def listofdic_to_xml(root_tagname, sec_tagname, dataList):
doc = xml.dom.minidom.Document()
rootNode = doc.createElement(root_tagname)
rootNode.attributes["xmlns"] = XMLNS
doc.appendChild(rootNode)
if dataList:
for subData in dataList:
secNode = doc.createElement(sec_tagname)
rootNode.appendChild(secNode)
if not subData:
nullNode = doc.createTextNode("")
secNode.appendChild(nullNode)
continue
for k,v in subData.items():
keyNode = doc.createElement(k)
secNode.appendChild(keyNode)
keyNode.appendChild(doc.createTextNode(v))
else:
nullNode = doc.createTextNode("")
rootNode.appendChild(nullNode)
return doc.toxml("utf-8")