def addSimple(parent, name, text = None): elem = doc.createElementNS(XMLNS_IFACE, name) parent.appendChild(doc.createTextNode('\n' + ' ' * (1 + depth(parent)))) parent.appendChild(elem) if text: elem.appendChild(doc.createTextNode(text)) return elem
def close(element): element.appendChild(doc.createTextNode('\n' + ' ' * depth(element)))