Message81259
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. |
|
Date |
User |
Action |
Args |
2009-02-06 11:13:45 | ods | set | recipients:
+ ods |
2009-02-06 11:13:45 | ods | set | messageid: <1233918825.25.0.360851750395.issue5166@psf.upfronthosting.co.za> |
2009-02-06 11:13:43 | ods | link | issue5166 messages |
2009-02-06 11:13:43 | ods | create | |
|