Re: Possible bug in the specification of createComment

* Thomas Conway wrote:
>As a piece of routine testing using the Python 2.5 binding to DOM, I
>tried the following:
>
>	elem.appendChild(doc.createComment("-->"))
>
>The provided serializer toxml(), yields an XML document which is not
>well formed. I.e. it contains the following:
>
>	<!---->-->

Yes, DOM Level 3 Core addresses this case, saying

  No lexical check is done on the content of a comment and it is
  therefore possible to have the character sequence "--"
  (double-hyphen) in the content, which is illegal in a comment
  per section 2.5 of [XML 1.0]. The presence of this character
  sequence must generate a fatal error during serialization.

>3. The serializer (toxml, in this case) should throw an exception. As
>far as I am aware, this would not require a change to the specification,
>though it would be very helpful if a change was made to help
>implementers get this right.

What else could the specification (which?) say?
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Tuesday, 6 November 2007 16:35:28 UTC