W3C home > Mailing lists > Public > www-validator@w3.org > October 2013

Re: Fatal Error?

From: Michael[tm] Smith <mike@w3.org>
Date: Wed, 30 Oct 2013 19:59:18 +0900
To: Salonboot Rondvaart Den Haag & Delft <info@salonbootdenhaag.nl>
Cc: www-validator@w3.org
Message-ID: <20131030105916.GG6780@sideshowbarker>
Salonboot Rondvaart Den Haag & Delft <info@salonbootdenhaag.nl>, 2013-10-30 00:16 +0100:

> Validating a URL on Validator.nu makes crash

As Jukka pointed out in his reply, it's not crashing. It's stopping by design.

> with a "Fatal Error:
> 
> Cannot recover after last error. Any further errors will be ignored."
> 
> http://validator.nu/?doc=http%3A%2F%2Fwww.salonbootdenhaag.nl%2Findex.html
> 
> Why is this?

Short answer: Because at line 493-494 of that document there's the
following broken markup:

  <FONT style="FONT-SIZE: 11px" color=#808080>↩
  <DIV class=hreview-aggregate><FONT color=#f9c206>★★★★★</FONT> Salonboot
  <SPAN class=item><SPAN class=fn>Rondvaart Den Haag</SPAN></SPAN> &amp;
  Delft <SPAN class=rating><SPAN class=average>8.9</SPAN> / <SPAN
  class=best>10</SPAN> </SPAN>op basis van <SPAN class=votes>90</SPAN>
  beoordelingen.</FONT></DIV>

Outside of the fact that the FONT element is not valid, what's even more
broken about it is that the document has a DIV element misnested inside a
FONT element, like this:  <FONT>↩<DIV>...</FONT></DIV>

Fix that misnesting problem and you'll be able to continue validating.

Longer answer: The reason the validator is stopping when it hits that
problem is, it validates documents in a completely streaming way, without
constructing a DOM or any kind of DOM-like thing in memory -- but there are
some markup error cases for which the HTML spec defines non-streaming error
recovery (which essentially sorta assumes you're constructing a DOM).

In this case, the way the HTML spec requires parsers to recover from the
mis-nested element in the markup above is to change it to this:

  <FONT style="FONT-SIZE: 11px" color=#808080>↩</FONT>
  <DIV class=hreview-aggregate><FONT style="FONT-SIZE: 11px"
  color=#808080>↩</FONT><FONT color=#f9c206>★★★★★</FONT> Salonboot
  <SPAN class=item><SPAN class=fn>Rondvaart Den Haag</SPAN></SPAN> &amp;
  Delft <SPAN class=rating><SPAN class=average>8.9</SPAN> / <SPAN
  class=best>10</SPAN> </SPAN>op basis van <SPAN class=votes>90</SPAN>
  beoordelingen.</FONT></DIV>

Notice the closing </FONT> tag that's been inserted in the first line, as
well as <FONT style="FONT-SIZE: 11px" color=#808080> start tag that's been
inserted right after <DIV class=hreview-aggregate>.

When doing streaming parsing, the parser doesn't (can't) rewind to go back
and inject those FONT start tags at some earlier point in the document. So
it stops and says, "Cannot recover after last error." and tells you exactly
what the last error was, so that you can go back and fix that error, and
then re-validate.

   --Mike

-- 
Michael[tm] Smith http://people.w3.org/mike
Received on Wednesday, 30 October 2013 10:59:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:09 UTC