[issue20714] Allow for ]]> in CDATA in minidom

Martin v. Löwis report at bugs.python.org
Sun Feb 23 22:11:50 CET 2014


Martin v. Löwis added the comment:

I fail to see the bug in Python. minidom is behaving correctly. The error is in xmlrunner, which does

  error_info = str(test_result.get_error_info())
  failureText = xml_document.createCDATASection(error_info)

This is incorrect - it would have to check that error_info does not contain ]]> (since CDATA sections must not contain ]]>). If it finds ]]> in the error_info, it would have to create two CDATA sections, e.g. one up to and including ]], and the second one starting at > (repeated if there is more than one occurrence of ]]> in error_info.

Alternatively, it should just create a text node, since writing a text node will properly escape all special characters in error_info.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20714>
_______________________________________


More information about the Python-bugs-list mailing list