comparison genshi/input.py @ 419:d2dc490aa998 trunk

Fix for #105. Thanks to Maciej Ligenza for the patch.
author cmlenz
date Fri, 16 Mar 2007 09:13:02 +0000
parents 4675d5cf6c67
children 5d08a744636e
comparison
equal deleted inserted replaced
418:c478a6fa9e77 419:d2dc490aa998
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():
Copyright (C) 2012-2017 Edgewall Software