def add_element(self, name, attrs={}, parent=None, text=""):
"""
- Generic wrapper around etree.SubElement(). Adds an element to
+ Wrapper around etree.SubElement(). Adds an element to
specified parent node. Adds element to root node is parent is
not specified.
"""
if opt.text == value:
elem.remove(opt)
- def get_attributes(self, elem=None, recursive=False):
+ def get_attributes(self, elem=None, depth=None):
if elem == None:
elem = self.root_node
attrs = dict(elem.attrib)
attrs['text'] = str(elem.text).strip()
- if recursive:
+ if depth is None or isinstance(depth, int) and depth > 0:
for child_elem in list(elem):
key = str(child_elem.tag)
if key not in attrs: