示例#1
0
    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
示例#2
0
 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)