I ran into a difference between Python on Windows XP and Linux Fedora
6.
Writing a dom to xml with minidom works on Linux. It gives an error on
XP if there is an empty namespace. The problem was handled in CVS a
while ago.
http://mail.python.org/pipermail/xml...er/009904.html
Here is an example on XP
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
u'<?xml version="1.0" ?><root>value</root>'>>from xml.dom.minidom import parseString
doc = parseString('<r oot>value</root>')
doc.toxml()
Traceback (most recent call last):>>doc = parseString('<r oot xmlns="">value</root>')
doc.toxml()
File "<stdin>", line 1, in <module>
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 45, in toxml
return self.toprettyxm l("", "", encoding)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 57, in
toprettyxml
self.writexml(w riter, "", indent, newl, encoding)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 1744, in
writexml
node.writexml(w riter, indent, addindent, newl)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 809, in
writexml
_write_data(wri ter, attrs[a_name].value)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 299, in
_write_data
data = data.replace("& ", "&").replac e("<", "<")
AttributeError: 'NoneType' object has no attribute 'replace'
and it's working on Linux
Python 2.4.4 (#1, Oct 23 2006, 13:58:00)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
u'<?xml version="1.0" ?>\n<root>value </root>'>>from xml.dom.minidom import parseString
doc = parseString('<r oot>value</root>')
doc.toxml()
u'<?xml version="1.0" ?>\n<root xmlns="">value</root>'>>doc = parseString('<r oot xmlns="">value</root>')
doc.toxml()
Should the library on XP be updated?
Gary