xml tree writing with ElementTree; prepends elements with ns0

Alain Ketterlin alain at dpt-info.u-strasbg.fr
Tue Oct 11 05:46:11 EDT 2011


Alain Ketterlin <alain at dpt-info.u-strasbg.fr> writes:
> "Alex van der Spek" <alex.vanderspek at tno.nl> writes:
>>> When reading a tree and writing it back to a new file all the elements are 
>> prepended with the string ns0:
>> That's a namespace prefix.
>>>>> Why is it prepended and how can I suppress this?
>> See http://effbot.org/zone/element-namespaces.htm
>> I'm not sure you can define the default namespace (i.e., avoid prefixes
> on element names). However, any conformant XML processor should have no
> problem with the output of ElementTree.

Sorry, it looks like you can with ET 1.3: see
http://effbot.org/zone/elementtree-13-intro.htm
> If you're actually producing HTML, then you should say so when calling
> tostring(), by giving the appropriate value to the method argument.
>> -- Alain.



More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /