[Python-bugs-list] [ python-Bugs-549725 ] xml.dom.minidom doesn't pass CDATA

noreply@sourceforge.net noreply@sourceforge.net
Sun, 28 Apr 2002 11:55:49 -0700


Bugs item #549725, was opened at 2002-04-28 08:41
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=549725&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Urlichs (smurf)
Assigned to: Nobody/Anonymous (nobody)
Summary: xml.dom.minidom doesn't pass CDATA

Initial Comment:
>>> import sys
>>> from sxml.xml2py import parseFile
# this is a simple wrapper to xml.dom.minidom.parse()
>>> x=parseFile(sys.stdin)

<?xml version="1.0" ?>           
<foo><![CDATA[dies ist
ein bar
]]></foo>
^D

>>> x
[<DOM Element: foo at 1076384172>]
>>> x.childNodes[0].childNodes
[<DOM Text node "dies ist">, <DOM Text node "\n">, <DOM Text node "ein bar">, <DOM Text node "\n">]
>>> 

I was expecting a CDATASection node here.
(In fact, my code would like to depend on it.)


----------------------------------------------------------------------

>Comment By: Matthias Urlichs (smurf)
Date: 2002-04-28 18:55

Message:
Logged In: YES 
user_id=10327

SXML is a project of mine. As I said, it's just a simple wrapper for minidom.

Why should CDATA handling be optional? It seems that it should be _easier_ to package the string into one CDATASection element. Instead, four Text elements are used -- the first line, the first linefeed, the second line, and the second linefeed. It's additional effort, and I'd like to turn it off if I don't want it.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-04-28 13:59

Message:
Logged In: YES 
user_id=21627

What is sxml? Why is this a bug in Python?

Notice that the use of CDATA in the DOM is completely
optional - the DOM tree represents your document correctly.
Code relying on CDATA is broken.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=549725&group_id=5470