jonathan miller added the comment:

A flexible and pretty simple way opf loosening up handling namespaces would be 
to OPTIONALLY change what is done at parse time:

1.  Don't handle xmlns declarations specially.  Leave them as normal 
attributes, and the Element.attrib would have a normal entry for each.

2. Leave the abbreviation colon-separated prefix in front of the element
tags as they come in.

If the using code wants, it can walk the ElementTree contents making 
dictionaries of the active namespace declarations, tucking a dict reference 
into each Element.  Maybe put in an ElementTree method that does this, why not?

I'm interested in this topic because I wish to handle xml from a variety of 
different tools, some of which had their XML elements defined without 
namespaces.  They can use element names which are really common - like 
'project' - and have no namespace definitions.  Worse:   if you put one in, the 
tool that originally used the element breaks.

Doing things as suggested gives the user the opportunity to look for matches 
using the colonized names, to shift namespace abbrevs easily, and to write out 
nicely namespaced code with abbrevs on the elements easily.

This would be OPTIONAL:  the way etree does it now, full prefixing of URI, is 
the safe way and should be retained as the default.

----------
nosy: +jjmiller50

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18304>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to