W3C home > Mailing lists > Public > www-validator@w3.org > September 2004

Re: Error Message Feedback

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 19 Sep 2004 21:19:14 +0300 (EEST)
To: Seguer of the Void <seguer_au@hotmail.com>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0409192112330.25989@korppi.cs.tut.fi>

On Sun, 19 Sep 2004, Seguer of the Void wrote:

> Line 95, column 5: end tag for element "P" which is not open
- -
> <p>
> <div class="stats">
> 	<a class="header">Total: </a><a>34</a><br />
> 	<a class="header">Allows: </a><a>30</a><br />
> 	<a class="header">Blocks: </a><a>4</a><br />
> </div>
> </p>

By HTML syntax, a <p> element may contain only text-level (inline)
elements, not block elements like <div>. Thus, when validating against
HTML 4.01 document type, a validator implies, by HTML rules, an end tag
</p> when a <p> element has been opened but not closed and a <div> tag is
encountered. That is, <div> implicitly terminates an open <p> element.
And this makes the </p> tag homeless.

On the other hand, getting this message suggests that you are validating
against HTML 4.01 (or something similar), but you are using <br /> as in
XHTML. Although this mostly works on browsers, it tends to cause problems
in validation in many situations.

If you used an XHTML doctype, then the validator would report a missing
</p> tag when it encounters the <div> tag, since in XHTML no end tag
omission is allowed.

(I don't mean you should use XHTML; actually I think nobody should use
XHTML unless he really knows what he is doing _and_ has a practical reason
to use XHTML. But my main point is that mixing old HTML and XHTML in the
same document will lead you into confusion, sooner or later.)

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Sunday, 19 September 2004 18:19:48 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:42 UTC