W3C home > Mailing lists > Public > www-validator@w3.org > June 2003

Re: W3 Validator XHTML parse error with CGI.pm generated $query->start_html(-script)

From: Tim Bagot <tsb-w3-validator-0008@earth.li>
Date: Fri, 13 Jun 2003 19:41:46 +0000 (UTC)
To: <www-validator@w3.org>
Cc: "Lincoln D. Stein" <lstein@cshl.org>, Brock Murch <bmurch@seas.marine.usf.edu>
Message-ID: <Pine.LNX.4.33.0306131929001.1021-100000@213-152-52-166.dsl.eclipse.net.uk>

At 2003-06-13T13:44-0400, Brock Murch wrote:-

> Basically the XML validator chokes on comments inside the <script> tag with
> xhtml. If there is a open <!-- to hide the script... (placed there via the
> CGI.pm module) and later a decrement is used (ie var this-- ) the parser
> calls it a  "invalid comment declaration" I have saved a copy of the script
> output as a static page here:

> To make the page pass the parse test I only need to do remove the <!--comments
> tags-->:

The validator is correct - you are not allowed to put "--" inside an XML
comment. (Even in (SGML) HTML it would be wrong in this case.) In XHTML
the content of the script element is #PCDATA, not CDATA (since XML doesn't
have the latter), so all markup is treated normally. In particular, you do
indeed want a CDATA section so that you don't need to escape markup
characters all over the place; but you do not want to put the script
inside <!-- -->, because in XHTML's script element that really is a
comment. You may wish to consider using <script src="..." /> instead.


Tim Bagot
Received on Friday, 13 June 2003 15:41:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:09 GMT