Hello Fredrik, Wednesday, May 10, 2006, 2:01:30 PM, you wrote: [...]
and so on. which means that
f = open("file.xml", "wb") f.write(ET.tounicode(tree))
will sometimes work, and sometimes fail, and sometimes generate broken XML files, depending on the data. while
f = open("file.xml", "wb") f.write(ET.tostring(tree))
will always do the right thing. ...agreed, *if* the "right thing" is serializing. If I want to process that unicode data, I would have to encode it as unicode, then process it. And for a large string, that would at a lot of resources, not to mention all the trouble involved. As I pointed out: that are places for using .tounicode(), and places for using .tostring().
-- Best regards, Steve mailto:howe@carcass.dhs.org