473,511 Members | 14,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xml.dom.minidom: how to preserve CRLF's inside CDATA?

Hi all.
i'm faced to trouble using minidom:

#i have a string (xml) within CDATA section, and the section includes
"\r\n":
iInStr = '<?xml version="1.0"?>\n<Data><![CDATA[BEGIN:VCALENDAR\r
\nEND:VCALENDAR\r\n]]></Data>\n'
#After i create DOM-object, i get the value of "Data" without "\r\n"

from xml.dom import minidom
iDoc = minidom.parseString(iInStr)
iDoc.childNodes[0].childNodes[0].data # it gives u'BEGIN:VCALENDAR
\nEND:VCALENDAR\n'
according to http://www.w3.org/TR/REC-xml/#sec-line-ends

it looks normal, but another part of the documentation says that "only
the CDEnd string is recognized as markup": http://www.w3.org/TR/REC-xml/#sec-cdata-sect

so parser must (IMHO) give the value of CDATA-section "as is" (neither
both of parts of the document do not contradicts to each other).
How to get the value of CDATA-section with preserved all symbols
within? (perhaps use another parser - which one?)
Many thanks for any help.

May 22 '07 #1
0 2894

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

Similar topics

9
6845
by: Geiregat Jonas | last post by:
I'm using xml.dom.minidom, I get some data by using obj.getElementsByTagName("name") then I have an object, but how can I get the data between the tags ? I could do .toxml() and then strip it...
0
7478
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...
0
1435
by: Oliver Walczak | last post by:
Can i call normalize to the dom root node so that all adjacent child text nodes attached to one of the element nodes are joined? -----Ursprüngliche Nachricht----- Von:...
1
1946
by: Paulo Pinto | last post by:
Hi, I having a problem with xml.dom.minidom parser while reading some in-house XML configuration files. The files have a DTD at the begining of the file specying the XML structure. Some of...
0
1890
by: Scott F | last post by:
Hi all, Today's embarassingly simple question goes like this. I have a file, testdoc.xml, to parse. Inside the file is an element <refrain>Yo, Ho, Ho</refrain> So, starting with
2
2251
by: Derek Basch | last post by:
Hello, If I want minidom to output XHTML that includes normally XML escaped characters how would I do it? For instance if I use doc.createCDATASection() I get: <!]> and without the...
3
6629
by: Neeraj Agrawal | last post by:
I have a text which may have character sequence ']]>' and I want to put it inside a CDATA tag. Is it possible to encode this secquence in the xml ? Thanks in advance -Neeraj
4
6040
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
9
1596
by: Lonnie Princehouse | last post by:
Hi all, I'm getting a seg fault when I try to use minidom to parse some XML inside a wxPython app. I was wondering if someone else could run the simple code below on Linux and, if it doesn't...
18
758
by: sim.sim | last post by:
Hi all. i'm faced to trouble using minidom: #i have a string (xml) within CDATA section, and the section includes "\r\n": iInStr = '<?xml version="1.0"?>\n<Data><!]></Data>\n' #After i...
0
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
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...
0
7371
Oralloy
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,...
0
7432
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...
0
5676
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,...
1
5077
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
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 ...
1
791
muto222
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.