Ignoring XML Namespaces with cElementTree

Carl Banks pavlovevidence at gmail.com
Sat May 1 06:17:32 EDT 2010


On Apr 27, 6:42 pm, dmtr <dchich... at gmail.com> wrote:
> Is there any way to configure cElementTree to ignore the XML root
> namespace?  Default cElementTree (Python 2.6.4) appears to add the XML
> root namespace URI to _every_ single tag.  I know that I can strip
> URIs manually, from every tag, but it is a rather idiotic thing to do
> (performance wise).

Perhaps upgrade to lxml.  Not sure if gives you control over namespace
expansion but if it doesn't it should at least be faster.

For this and some other reasons, I find ElementTree not quite as handy
when processing files from another source as when I'm saving and
retrieving my own data.


Carl Banks



More information about the Python-list mailing list