changeset 79:922bd718352b

added remove_all method to remove all subelements without clearing attr (like clear method does)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 01 Aug 2010 20:05:44 +0200
parents 1481eb88baf8
children 3603f1e39613
files emeraldtree/tree.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/tree.py	Thu Jun 10 15:58:51 2010 +0200
+++ b/emeraldtree/tree.py	Sun Aug 01 20:05:44 2010 +0200
@@ -237,6 +237,12 @@
         self._children.remove(element)
 
     ##
+    # Removes all subelements.
+
+    def remove_all(self):
+        self._children = []
+
+    ##
     # Finds the first matching subelement, by tag name or path.
     #
     # @param path What element to look for.
@@ -277,7 +283,7 @@
 
     def clear(self):
         self.attrib.clear()
-        self._children = []
+        self.remove_all()
 
     ##
     # Gets an element attribute.