Ignoring XML Namespaces with cElementTree

dmtr dchichkov at gmail.com
Fri Apr 30 23:59:12 CEST 2010

> I think that's your main mistake: don't remove them. Instead, use the fully
> qualified names when comparing.
> Stefan

Yes. That's what I'm forced to do. Pre-calculating tags like tagChild
= "{%s}child" % uri and using them instead of "child". As a result the
code looks ugly and there is extra overhead concatenating/comparing
these repeating and redundant prefixes. I don't understand why
cElementTree forces users to do that. So far I couldn't find any way
around that without rebuilding cElementTree from source.

Apparently somebody hard-coded the namespace_separator parameter in
the cElementTree.c (what a dumb thing to do!!!, it should have been a
parameter in the cElementTree.XMLParser() arguments):
self->parser = EXPAT(ParserCreate_MM)(encoding, &memory_handler, "}");

Simply replacing "}" with NULL gives me desired tags without stinking

More information about the Python-list mailing list