473,624 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Empty string namespace on XP in minidom

Howdy

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.
>>from xml.dom.minidom import parseString
doc = parseString('<r oot>value</root>')
doc.toxml()
u'<?xml version="1.0" ?><root>value</root>'
>>doc = parseString('<r oot xmlns="">value</root>')
doc.toxml()
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
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("& ", "&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>')
doc.toxml()
u'<?xml version="1.0" ?>\n<root>value </root>'
>>doc = parseString('<r oot xmlns="">value</root>')
doc.toxml()
u'<?xml version="1.0" ?>\n<root xmlns="">value</root>'
Should the library on XP be updated?

Gary

Jul 7 '07 #1
0 1509

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

Similar topics

0
7499
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>
49
2797
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 ....
4
2862
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:
0
1880
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
0
8170
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8619
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
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 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.