[issue1390] toxml generates output that is not well formed

Thomas Conway report at bugs.python.org
Mon Nov 5 22:36:50 CET 2007

Thomas Conway added the comment:

Hi Martin,

You write:
    It's not a bug in toxml, which should always serialize the
    DOM tree if possible.

Right! In this case it is *not* possible. The generated serialization is
not a well formed XML document.

Having just consulted the DOM technical reports, I see that
createComment is specified as not generating any exceptions, so although
it would be quite a sensible place to check that one was not creating an
insane document, probably one should not do the check there. I think
you're right that this *is* a bug in DOM, and I will report it there.

Having said that, I still think that toxml should throw an exception. In
general, if toxml succeeds, I would expect to be able to parse the result.

I can propose a doco change, but I think such would only be a partial
solution. Something like the following addition to the description for

Note that comments containing the string C{-->} may make the document


Tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list