473,544 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Empty string namespace on XP in minidom


I ran into a difference between Python on Windows XP and Linux Fedora

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.

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.
>>from xml.dom.minidom import parseString
doc = parseString('<r oot>value</root>')
u'<?xml version="1.0" ?><root>value</root>'
>>doc = parseString('<r oot xmlns="">value</root>')
Traceback (most recent call last):
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
self.writexml(w riter, "", indent, newl, encoding)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 1744, in
node.writexml(w riter, indent, addindent, newl)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 809, in
_write_data(wri ter, attrs[a_name].value)
File "C:\tools\Pytho n25\lib\xml\dom \minidom.py", line 299, in
data = data.replace("& ", "&amp;").replac e("<", "&lt;")
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.
>>from xml.dom.minidom import parseString
doc = parseString('<r oot>value</root>')
u'<?xml version="1.0" ?>\n<root>value </root>'
>>doc = parseString('<r oot xmlns="">value</root>')
u'<?xml version="1.0" ?>\n<root xmlns="">value</root>'
Should the library on XP be updated?


Jul 7 '07 #1
0 1506

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: xtian | last post by:
Hi - I'm doing some data conversion with minidom (turning a csv file into a specific xml format), and I've hit a couple of small problems. 1: The output format has a header with some xml that looks something like this: <item xmlns="" xmlns:thing="http://www.blah.com"> <thing:child name="smith"/> </item>
by: Christopher J. Bottaro | last post by:
I find myself doing the following very often: class Struct: pass .... blah = Struct() blah.some_field = x blah.other_field = y ....
by: Derek Basch | last post by:
Hello All, I ran into a problem while dynamically constructing XHTML documents using minidom. If you create a script tag such as: script_node_0 = self.doc.createElement("script") script_node_0.setAttribute("type", "text/javascript") script_node_0.setAttribute("src", "../test.js") minidom renders it as:
by: Fred | last post by:
I am trying to build a consumer to a webservice which use soapheader. I am using Visual Studio 2003. Please see the wsdl-file below. Why is it that the SOAPHEADER is empty when I use it int the header instead of as part of the input message? Is there a limitation of VS2003? Please any ideas are appreciated?! TIA Fred
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.