473,323 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

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 2887

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

Similar topics

9
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
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
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
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
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
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
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
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
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
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.