ElementTree Namespace Prefixes

Martijn Faassen faassen at infrae.com
Fri Jun 17 08:40:10 EDT 2005


Jarek Zgoda wrote:
[snip]
>> It's a shame the default ns behavior in Elementtree is in such a poort 
>> staten. I'm surprised no one's forked Elementtree solely to fix this 
>> issue.
> 
> There is at least one ElementTree API implementation that retains 
> prefixes, lxml.ETree. Go google for it.

Just to make it explicitly clear, lxml is not a fork of ElementTree 
fork, but a reimplementation of the API on top of libxml2.

ElementTree indeed retains prefixes, and since version 0.7 released 
earlier this way, it's also possible to get some control over generation 
of prefixes during element construction.

You can find it here:

http://codespeak.net/lxml

Regards,

Martijn




More information about the Python-list mailing list