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

Re: [www-validator] <none>

From: Tim Bagot <tsb-w3-validator-0007@earth.li>
Date: Wed, 29 Jan 2003 18:46:08 +0000 (UTC)
To: <www-validator@w3.org>
Cc: "Brinkman, Dave" <Dave.Brinkman@stockport.ac.uk>
Message-ID: <Pine.LNX.4.33.0301291814350.1162-100000@213-152-52-166.dsl.eclipse.net.uk>

At 2003-01-29T16:34-0000, Brinkman, Dave wrote:-

> Problem 2
>
> This validator is throwing out as invalid any JavaScript comparisons
> with < as if it needed &lt; which incorrect since the validator should
> not force the use of html comments or xml CDATA within JavaScript.

In HTML: "Comments" are just a hack to stop old, script-unaware browsers
displaying the content, and in theory get passed to the scripting engine
as-is; technically, they are not required. "<" in script content is fine.
"&lt;" won't work, because "&" has no special meaning in CDATA content.
What you must avoid is any occurrence of "</", because that will terminate
the CDATA content. In (Java|ECMA)Script, for example, you can escape the
"/" ("<\/") or use string concatenation.

In XHTML: The CDATA content model does not exist in XML; script content is
now PCDATA. Therefore comments really are comments and "<" in the script
must be escaped. You can use &lt; (or &#60; etc.), or put all or part of
the script in a CDATA section. The compatibility guidelines recommend
using an external script instead.

> Problem 3
>
> This validator is throwing out as invalid any 'get' data within an
> href="url?... " that has an ampersand in. Yes I know &amp; works but
> it is already within quotes and should be ignored as CDATA.

Unfortunately and inexplicably, CDATA for attribute values is not the same
as CDATA for element content. You must use &amp; (or equivalent). (Or, if
the application on the server supports it, use ";" instead of "&".)


Tim Bagot
Received on Wednesday, 29 January 2003 13:46:13 GMT

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