
Varified using python-elementtree v.1.2.6-8 on Debian PPC (Sid):
import elementtree.ElementTree as ET
element = ET.Element('element') subelement = ET.Element('subelement') subelement.set('{http://www.w3.org/XML/1998/namespace}id', 'foo') element.append(subelement) ET.dump(element) <element><subelement xml:id="foo" /></element> subelement.attrib {'{http://www.w3.org/XML/1998/namespace}id': 'foo'}
On 29/05/06, Fredrik Lundh <fredrik@pythonware.com> 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'}
</F>
_______________________________________________ lxml-dev mailing list lxml-dev@codespeak.net http://codespeak.net/mailman/listinfo/lxml-dev
-- "Creativity can be a social contribution, but only in so far as society is free to use the results." - R. Stallman