This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Kyle.Keating
Recipients Kyle.Keating, terry.reedy
Date 2011-06-02.17:10:39
SpamBayes Score 0.0006477235
Marked as misclassified No
Message-id <1307034640.22.0.948698014306.issue12129@psf.upfronthosting.co.za>
In-reply-to
Content
This looks to break pretty good... I did confirm this on 3.0, I'm guessing 3.2 is the same.

import sys
import xml.dom

doc = xml.dom.getDOMImplementation().createDocument(None, 'xml', None)
doc.firstChild.appendChild(doc.createElement('element00'))

element01 = doc.createElement('element01')
element01.setAttribute('attribute', "script><![CDATA[alert('script!');]]></script>")
doc.firstChild.appendChild(element01)

element02 = doc.createElement("script><![CDATA[alert('script!');]]></script>")
doc.firstChild.appendChild(element02)

element03 = doc.createElement("new line \n")

element03.setAttribute('attribute-name','new line \n')
doc.firstChild.appendChild(element03)

print doc.toprettyxml(indent="  ")

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
output:

<?xml version="1.0" ?>
<xml>
  <element/>
  <element01 attribute="script&gt;&lt;![CDATA[alert('script!');]]&gt;&lt;/script
&gt;"/>
  <script><![CDATA[alert('script!');]]></script>/>
  <new line
 attribute-name="new line
"/>
</xml>
History
Date User Action Args
2011-06-02 17:10:40Kyle.Keatingsetrecipients: + Kyle.Keating, terry.reedy
2011-06-02 17:10:40Kyle.Keatingsetmessageid: <1307034640.22.0.948698014306.issue12129@psf.upfronthosting.co.za>
2011-06-02 17:10:39Kyle.Keatinglinkissue12129 messages
2011-06-02 17:10:39Kyle.Keatingcreate