
May 29, 2006
5:22 p.m.
Hi Fredrik, sorry for the confusion. Fredrik Lundh wrote:
Stefan Behnel wrote:
What surprises me most is that ElementTree (1.2.6) has a similar bug. It returns this for subelement.attrib after appending:
{'{}id': 'foo'}
that's somewhat surprising, given that ET doesn't do any mangling by itself; that's entirely up to the serialization code.
here's what I get on my machine:
e = ET.Element("subelement") e.set("{http://www.w3.org/XML/1998/namespace}id", "foo") e <Element subelement at b42d28> ET.tostring(e) '<subelement xml:id="foo" />' e.attrib {'{http://www.w3.org/XML/1998/namespace}id': 'foo'}
I get that, too. I had forgotten a tiny 'self.' in the test case, which let it use etree instead of ElementTree. Oh well, imports ... Sorry, Stefan