Author jjmiller50
Recipients brycenesbitt, eli.bendersky, jjmiller50, martin.panter, pocek, rhettinger, scoder
Date 2016-07-27.13:00:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469624450.16.0.71933595696.issue18304@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-07-27 13:00:50jjmiller50setrecipients: + jjmiller50, rhettinger, scoder, eli.bendersky, martin.panter, brycenesbitt, pocek
2016-07-27 13:00:50jjmiller50setmessageid: <1469624450.16.0.71933595696.issue18304@psf.upfronthosting.co.za>
2016-07-27 13:00:50jjmiller50linkissue18304 messages
2016-07-27 13:00:49jjmiller50create