Message161068
When parsing something like '<a>x</a><a>y</a>' with xml.etree.ElementTree, or '{}{}' with json, these parser throw exceptions instead of reading a single element of the kind they understand off the stream (or throwing an exception if there is no element they understand) and leaving the stream in a sane state.
So I should be able to write
import xml.etree.ElementTree as et
import StringIO
s = StringIO.StringIO("<a>x</a><a>y</a>")
elem1 = et.parse(s)
elem2 = et.parse(s)
and have elem1 correspond to "<a>x</a>" and elem2 correspond to "<a>y</a>".
At the very least, if the parsers refuse to parse partial streams, they should at least not destroy the streams. |
|
Date |
User |
Action |
Args |
2012-05-18 17:29:22 | Frederick.Ross | set | recipients:
+ Frederick.Ross |
2012-05-18 17:29:22 | Frederick.Ross | set | messageid: <1337362162.37.0.214988903095.issue14852@psf.upfronthosting.co.za> |
2012-05-18 17:29:21 | Frederick.Ross | link | issue14852 messages |
2012-05-18 17:29:21 | Frederick.Ross | create | |
|