Revision 4318
Added by Aaron Marcuse-Kubitza about 12 years ago
xml_dom.py | ||
---|---|---|
251 | 251 |
|
252 | 252 |
##### Child nodes |
253 | 253 |
|
254 |
def prune_empty(node): |
|
255 |
'''Removes node if it's empty''' |
|
256 |
if is_empty(node): remove(node) |
|
257 |
|
|
258 |
def prune_children(node): |
|
259 |
'''Removes empty children''' |
|
260 |
for child in NodeElemIter(node): prune_empty(child) |
|
261 |
|
|
254 | 262 |
def set_child(node, name, value): |
255 | 263 |
'''Note: does not remove any existing child of the same name''' |
256 | 264 |
child = node.ownerDocument.createElement(name) |
Also available in: Unified diff
xml_dom.py: Added prune_empty() and prune_children()