This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author atamyrat
Recipients atamyrat
Date 2011-05-12.21:11:15
SpamBayes Score 2.3496596e-05
Marked as misclassified No
Message-id <1305234676.35.0.0571872848833.issue12066@psf.upfronthosting.co.za>
In-reply-to
Content
Parsing "<test xmlns=''></test>" with minidom and converting back to string raises an exception.

>>> import xml.dom.minidom
>>> xml.dom.minidom.parseString("<test xmlns=''></test>").toxml()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom.py", line 45, in toxml
    return self.toprettyxml("", "", encoding)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom.py", line 57, in toprettyxml
    self.writexml(writer, "", indent, newl, encoding)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom.py", line 1749, in writexml
    node.writexml(writer, indent, addindent, newl)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom.py", line 812, in writexml
    _write_data(writer, attrs[a_name].value)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom.py", line 301, in _write_data
    data = data.replace("&", "&amp;").replace("<", "&lt;")
AttributeError: 'NoneType' object has no attribute 'replace'
>>> 

Ii am not familiar with the XML spec so I've no idea if ignoring or accepting empty namespace is the right thing to do. If someone advices me on how it should be handled, I'd like to write a patch.
History
Date User Action Args
2011-05-12 21:11:16atamyratsetrecipients: + atamyrat
2011-05-12 21:11:16atamyratsetmessageid: <1305234676.35.0.0571872848833.issue12066@psf.upfronthosting.co.za>
2011-05-12 21:11:15atamyratlinkissue12066 messages
2011-05-12 21:11:15atamyratcreate