W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2007

Re: Possible bug in the specification of createComment

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 06 Nov 2007 17:35:28 +0100
To: Thomas Conway <conway@csse.unimelb.edu.au>
Cc: www-dom@w3.org
Message-ID: <3k51j3t61vukk2fddlaqh8bqgifaob5712@hive.bjoern.hoehrmann.de>

* 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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:13 UTC