ElementTree Namespace Prefixes

Chris Spencer usenet.20.evilspam at spamgourmet.com
Sun Jun 12 10:06:18 EDT 2005


Does anyone know how to make ElementTree preserve namespace prefixes in 
parsed xml files? The default behavior is to strip a document of all 
prefixes and then replace them autogenerated prefixes like ns0, ns1, 
etc. The correct behavior should be to write the file in the form that 
it was read, which it seems to do correctly for everything except 
namespace prefixes. The docs mention "proper" output can be achieved by 
using the Qname object, but they don't go into any detail. Any help is 
appreciated.

Thanks,
Chris Spencer



More information about the Python-list mailing list