Problem parsing namespaces with xml.dom.minidom

Mike McGavin iizogii at
Tue Jan 18 05:26:37 EST 2005

Hi Fredrik.

Fredrik Lundh wrote:

>>I'm not terribly experienced with XML in general, so it's possible that I'm just incorrectly 
>>interpreting how things are supposed to work to begin with.  If this is the case, please accept my 
>>apologies, but I'd like any suggestions for how I should be doing it.  I'd really just like to be 
>>able to parse an XML document into a DOM, and then be able to pull out elements relative to their 

> is the DOM API an absolute requirement?

It wouldn't need to conform to the official specifications of the DOM 
API, but I guess I'm after some comparable functionality.

In particular, I need to be able to parse a namespace-using XML document 
into some kind of node tree, and then being able to query the tree to 
select elements based on their namespace and local tag names, and so on. 
  I don't mind if the methods provided don't conform exactly to DOM 

I guess I could write my own code to build a namespace-recognising DOM 
from an XML file, but it seems as if that's already been done and I'd be 
very surprised if it hadn't.  I just can't figure out why minidom 
doesn't seem to be working properly for me when namespaces are involved.


More information about the Python-list mailing list