La suppression de préfixes d'espace de noms dans ElementTree 1.2

En python 2.7 (avec programme etree 1.3), je peux supprimer le XML préfixes sur des éléments comme ceci:

Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as etree
>>> etree.VERSION
'1.3.0'
>>> something = etree.Element('{http://some.namespace}token')
>>> etree.tostring(something)
'<ns0:token xmlns:ns0="http://some.namespace" />'
>>> etree.register_namespace('', 'http://some.namespace')
>>> etree.tostring(something)
'<token xmlns="http://some.namespace" />'

La register_namespace fonction a été ajoutée dans la 1.3. Je suis en train de supprimer le préfixe dans une manière qui est compatible avec python 2.6 du programme etree à la version 1.2.6. Voici ce que j'ai essayé:

Python 2.6.7 (r267:88850, Jul 31 2011, 19:30:54) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as etree
>>> etree.VERSION
'1.2.6'
>>> something = etree.Element('{http://some.namespace}token')
>>> etree.tostring(something)
'<ns0:token xmlns:ns0="http://some.namespace" />'
>>> etree._namespace_map['http://some.namespace'] = ''
>>> etree.tostring(something)
'<:token xmlns:="http://some.namespace" />'

Ce n'est pas ce que je veux. Les préfixes sont toujours là, mais sont vides. Est-il possible de les supprimer complètement?

InformationsquelleAutor jterrace | 2011-11-13