Project

General

Profile

« Previous | Next » 

Revision 6356

xml_dom.py: Added prune_parent()

View differences:

lib/xml_dom.py
266 266
    '''Removes node if it's empty'''
267 267
    if is_empty(node): remove(node)
268 268

  
269
def prune_parent(node):
270
    '''Removes node and then parent if it's empty'''
271
    parent = node.parentNode # save parent before detaching node
272
    remove(node)
273
    prune_empty(parent)
274

  
269 275
def prune_children(node):
270 276
    '''Removes empty children'''
271 277
    for child in NodeElemIter(node): prune_empty(child)

Also available in: Unified diff