def createElement(self, name, newName): name = unicode(name) newName = unicode(newName) newElem = XML.createElement(self, XmlNames.tagName) newElem.setAttribute(XmlNames.attributeName, newName) parent = self.getCurrentElement(name) parent.appendChild(newElem) self.save() self.elements[newName] = newElem
def __init__(self, xml_file, xml_str=None, parseFromFile=True): XML.__init__(self, xml_file, xml_str, parseFromFile) root = self.getDocumentElement() self.elements = { XmlNames.rootName: root } self.initElements(root)