W3C home > Mailing lists > Public > www-validator@w3.org > February 2007

Characters "<" and "&" incorrectly reported as warnings only

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sat, 3 Feb 2007 13:22:01 +0200 (EET)
To: www-validator@w3.org
Message-ID: <Pine.GSO.4.64.0702031312160.340@mustatilhi.cs.tut.fi>

The occurrence of the less than sign "<" or the ampersand "&" as character 
data in an XHTML document causes the W3C Markup Validator to issue a 
warning. The document is then reported as valid. For a trivial demo, see
This is incorrect, since such occurrences are errors by XML rules:

"The ampersand character (&) and the left angle bracket (<) MUST NOT 
appear in their literal form, except when used as markup delimiters, or 
within a comment, a processing instruction, or a CDATA section. If they 
are needed elsewhere, they MUST be escaped using either numeric character 
references or the strings "&amp;" and "&lt;" respectively."

Note that even the formal syntax in the XML specification excludes
"&" and "<" as data characters:
[14]    CharData    ::=    [^<&]* - ([^<&]* ']]>' [^<&]*)
This means that the data as a whole cannot match the production for 
"document", so it does not constitute an XML document at all, i.e. it is 
not even "well-formed" (ref.: 
http://www.w3.org/TR/REC-xml/#sec-well-formed ).

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Saturday, 3 February 2007 11:22:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:59:00 UTC