[New-bugs-announce] [issue13102] xml.dom.minidom does not support default namespaces

Glenn Washburn report at bugs.python.org
Tue Oct 4 22:11:54 CEST 2011

New submission from Glenn Washburn <crass at berlios.de>:

When using getAttributeNS, attributes with no namespace should be considered as having the default namespace for that scope.  See examples in http://www.w3.org/TR/REC-xml-names/#defaulting.  Python's xml.dom.minidom will always set the namespace to None for attributes that have no namespace prefix.

I've attached a test program to illustrate this issue in action.  The output I get is:
[((None, u'attr'), u'value1')]
[(('http://www.w3.org/2000/xmlns/', 'xmlns'), u'http://path/to/ns2#'), ((None, u'attr'), u'value2')]
[((u'http://path/to/ns2#', u'attr'), u'value3')]
Successfully got child3 attr value

In the first two cases the namespaceURI is None, but it should be set to the default namespace specified in the root element.  I believe this problem occurs with all *NS functions.  Not tested in 3.x.

components: XML
files: test.py
messages: 144924
nosy: crass
priority: normal
severity: normal
status: open
title: xml.dom.minidom does not support default namespaces
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file23313/test.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list