Summary
Namespace processing seems to be the 'will do later' entry on every XML toolkit author's list. Following from discussion in the recent thread "Simplifying XML Manipulation" I wanted to emphasise that namespaces are the key to reuse in schemas and hence any chance of rich data interchange. Don't ignore them!
Advertisement
Here's the first element showing how many (standardised) namespaces are being used in a typical example of the kind of XML we process.
This is used to represent complex data like assay results of samples taken from boreholes, complete with spatial coordinates and attribution to various parties in the processing chain.
I don't disagree that XML processing must be namespace aware, but my experience is that I have never had to deal with a document that had element name collisions i.e. I needed to se the namespace to differentiate between two types.
I think a parsing tool should allow users to forego specifying namespaces to retrieve an element.
After someone pointed out that the Python minidom doesn't support namespaces, I started noticing that xmlnode is really a kind of facade that utilizes an underlying XML implementation, and has a relatively clean interface to the underlying library. Thus, when elementree becomes available in Python 2.5, I can if I need to retarget to that and utilize the namespace mechanism in that library.
The key phrase being "if I need to," because in my own experience (automatically generating Ant build files and creating and reading XML to interact with services on the web), I haven't had to, so I've kept xmlnode down to "the simplest thing that could possibly work." If I run into a case where I need namespaces, I'll either evolve xmlnode or just use elementree for that problem, depending on which one involves the least pain.