Mercurial > genshi > genshi-test
comparison genshi/input.py @ 419:e41c8cff992f
Fix for #105. Thanks to Maciej Ligenza for the patch.
author | cmlenz |
---|---|
date | Fri, 16 Mar 2007 09:13:02 +0000 |
parents | 49a3bae5a8bb |
children | 95089b6e37ca |
comparison
equal
deleted
inserted
replaced
418:878ffab274a6 | 419:e41c8cff992f |
---|---|
28 __all__ = ['ET', 'ParseError', 'XMLParser', 'XML', 'HTMLParser', 'HTML'] | 28 __all__ = ['ET', 'ParseError', 'XMLParser', 'XML', 'HTMLParser', 'HTML'] |
29 | 29 |
30 def ET(element): | 30 def ET(element): |
31 """Convert a given ElementTree element to a markup stream.""" | 31 """Convert a given ElementTree element to a markup stream.""" |
32 tag_name = QName(element.tag.lstrip('{')) | 32 tag_name = QName(element.tag.lstrip('{')) |
33 attrs = Attrs(element.items()) | 33 attrs = Attrs([(QName(attr), value) for attr, value in element.items()]) |
34 | 34 |
35 yield START, (tag_name, attrs), (None, -1, -1) | 35 yield START, (tag_name, attrs), (None, -1, -1) |
36 if element.text: | 36 if element.text: |
37 yield TEXT, element.text, (None, -1, -1) | 37 yield TEXT, element.text, (None, -1, -1) |
38 for child in element.getchildren(): | 38 for child in element.getchildren(): |