Created
October 21, 2010 17:25
-
-
Save gelim/638905 to your computer and use it in GitHub Desktop.
lxml.etree and StrinIO strangeness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StringIO, lxml.etree | |
xmldata="<root>data</root>" | |
buffer=StringIO.StringIO(xmldata) | |
for event, element in lxml.etree.iterparse(buffer): | |
print "%s %s %s" % (event, element.tag, element.text) | |
buffer=StringIO.StringIO() | |
buffer.write(xmldata) | |
for event, element in lxml.etree.iterparse(buffer): | |
print "%s %s %s" % (event, element.tag, element.text) | |
buffer.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment