changeset 31:1b94f5f045de

ElementPath - Handle non-element nodes
author Bastian Blank <bblank@thinkmo.de>
date Tue, 08 Jul 2008 15:05:06 +0200
parents 96e02876b1a2
children 7b5ed8600569
files emeraldtree/ElementPath.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/ElementPath.py	Tue Jul 08 14:47:43 2008 +0200
+++ b/emeraldtree/ElementPath.py	Tue Jul 08 15:05:06 2008 +0200
@@ -64,11 +64,12 @@
     ).findall
 
 def prepare_tag(next, token):
+    from ElementTree import Element
     tag = token[1]
     def select(context, result):
         for elem in result:
             for e in elem:
-                if e.tag == tag:
+                if isinstance(e, Element) and e.tag == tag:
                     yield e
     return select