469,900 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,900 developers. It's quick & easy.

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 2705

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Geiregat Jonas | last post: by
reply views Thread by xtian | last post: by
reply views Thread by Oliver Walczak | last post: by
1 post views Thread by Paulo Pinto | last post: by
reply views Thread by Scott F | last post: by
2 posts views Thread by Derek Basch | last post: by
3 posts views Thread by Neeraj Agrawal | last post: by
4 posts views Thread by webdev | last post: by
9 posts views Thread by Lonnie Princehouse | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.