diff emeraldtree/ElementTree.py @ 9:e0965f86912a

Fix text iterator. emeraldtree/ElementTree.py: Fix Element.textiter.
author Bastian Blank <bblank@thinkmo.de>
date Sat, 31 May 2008 16:19:33 +0200
parents a30d65781076
children ec93cdb38b9e
line wrap: on
line diff
--- a/emeraldtree/ElementTree.py	Sat May 31 16:01:06 2008 +0200
+++ b/emeraldtree/ElementTree.py	Sat May 31 16:19:33 2008 +0200
@@ -509,13 +509,12 @@
     # @defreturn iterator
 
     def itertext(self):
-        if self.text:
-            yield self.text
         for e in self:
-            for s in e.itertext():
-                yield s
-            if e.tail:
-                yield e.tail
+            if isinstance(e, Element):
+                for s in e.itertext():
+                    yield s
+            elif isinstance(e, basestring):
+                yield e
 
 # compatibility
 _Element = _ElementInterface = Element