W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

Re: xml parsing error for < character

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 6 Sep 2000 21:29:15 +0200
Message-ID: <010001c01838$bf28a100$7eccb43e@de>
To: "Dave Raggett" <dsr@w3.org>
Cc: <html-tidy@w3.org>
* "Dave Raggett" <dsr@w3.org> wrote:
| Unfortunately, current HTML browsers don't recognize CDATA marked
| sections, and furthermore they expect script elements to have
| CDATA content, and hence expect < and & to be unescaped.

| The XHTML 1.0 standard therefore recommends you move your scripts
| to external files. The onmouseover and other event attributes
| are however ok, as browsers will deal with entities in attribute
| values.

| I am uncertain as what HTML Tidy should do about this problem.
| If it wraps the contents of a script element in a CDATA marked
| section, it will stop the pages working in existing browsers.

This workaround should meet all possible needs:

<script type="text/javascript">
<!-- --> <![CDATA[ /> <!--

document.write("<p>foobar<\/p>");

// --> <! ]]>
</script>

regards,
--
Björn Höhrmann ^ mailto:bjoern@hoehrmann.de ^ http://www.bjoernsworld.de
am Badedeich 7 ° Telefon: +49(0)4667/981ASK ° http://bjoern.hoehrmann.de
25899 Dagebüll # PGP Pub. KeyID: 0xA4357E78 # http://learn.to/quote +{i}
Received on Wednesday, 6 September 2000 15:30:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT