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

Re: Lexical error

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Thu, 25 Jan 2007 09:36:44 +0200 (EET)
To: Bob Hicks <roberthicks@mac.com>
cc: www-validator-css@w3.org
Message-ID: <Pine.GSO.4.64.0701250924150.25328@mustatilhi.cs.tut.fi>

On Wed, 24 Jan 2007, Bob Hicks wrote:

> What does this mean?
>
> 'Lexical error at line 1, column 4. Encountered: "\n" (10), after : "<!-"'
>
> No style sheet found

"Lexical error" means that an error was detecting in parsing HTML, at the 
low level of recognizing basic constructs. The message isn't optimally 
clear since it does not explicitly refer to the fact that at this phase, 
HTML and not CSS being processed. In lexical analysis of HTML markup, 
"<!-" was encountered, followed by a line break. (That's what '"\n" (10)' 
refers to, somewhat obscurely: "\n" is a notation for a line break in 
several programming languages and 10 is the code number of a character 
that is used as line break character. Neither of these notations is an 
HTML notation or a CSS notation!)

The construct, "<!-" followed by a line break, is not allowed in HTML.
In practice, you meant to write "<!--" but forgot the other "-". On the 
other hand, using <style type="text/css"><!-- and --></style> instead of 
simple <style type="text/css"> and </style> has been pointless for years, 
and it's also risky, as you've seen.

"No style sheet found" apparently means that after this error, the 
HTML parser used by "CSS Validator" does not try to extract the style 
sheet included in the <style> element for analysis as CSS code. The 
message is misleading, however, since the program may well detect and 
analyze _other_ style sheets in the document - in other <style> elements 
or in style="..." attributes - and yet it issues "No style sheet found" 
prominently and centered at the end of its report, _after_ issuing error 
messages about those style sheets.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Thursday, 25 January 2007 07:36:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 June 2012 00:14:18 GMT