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 ods
Recipients ods
Date 2009-02-06.11:13:42
SpamBayes Score 0.08850576
Marked as misclassified No
Message-id <1233918825.25.0.360851750395.issue5166@psf.upfronthosting.co.za>
In-reply-to
Content
ElementTree and minidom allow creation of not well-formed XML, that
can't be parsed:

>>> from xml.etree import ElementTree
>>> element = ElementTree.Element('element')
>>> element.text = u'\0'
>>> xml = ElementTree.tostring(element, encoding='utf-8')
>>> ElementTree.fromstring(xml)
[...]
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1,
column 9

>>> from xml.dom import minidom
>>> doc = minidom.getDOMImplementation().createDocument(None, None, None)
>>> element = doc.createElement('element')
>>> element.appendChild(doc.createTextNode(u'\0'))
<DOM Text node "">
>>> doc.appendChild(element)
<DOM Element: element at 0xb7ca688c>
>>> xml = doc.toxml(encoding='utf-8')
>>> minidom.parseString(xml)
[...]
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, colum

I believe they should raise some exception when there are characters 
not allowed in XML (http://www.w3.org/TR/REC-xml/#NT-Char) are used in
attribute values, text nodes and CDATA sections.
History
Date User Action Args
2009-02-06 11:13:45odssetrecipients: + ods
2009-02-06 11:13:45odssetmessageid: <1233918825.25.0.360851750395.issue5166@psf.upfronthosting.co.za>
2009-02-06 11:13:43odslinkissue5166 messages
2009-02-06 11:13:43odscreate