예제 #1
0
 def __init__(self, tag, attrib=_Attrib(), **extra):
     super(Element, self).__init__(tag)
     self.attrib = _Attrib()
     if attrib:
         self.attrib.update(attrib)
     if extra:
         self.attrib.update(extra)
예제 #2
0
 def SubElement(parent, tag, attrib=_Attrib(), **extra):
     """Must override SubElement as well otherwise _elementtree.SubElement
     fails if 'parent' is a subclass of Element object.
     """
     element = parent.__class__(tag, attrib, **extra)
     parent.append(element)
     return element