- From: Michael(tm) Smith <mike@w3.org>
- Date: Mon, 8 Nov 2010 17:51:43 +0900
- To: John Collins <john_collins70@rocketmail.com>
- Cc: www-validator@w3.org
John Collins <john_collins70@rocketmail.com>, 2010-11-07 13:15 -0800: > I’m the webmaster of http://www.canadabanks.net and after running my site > through the W3C markup validator.I got 7 errors. I understand most of the errors > and I’ll fix them however this one really bothers me: > Line 7, Column 489: end tag for element "HEAD" which is not open It seems like the cause of that problem is that your document is an XHTML1 document but you're trying to validate it as an HTML4 document. So the real fix is to either: - manually validate your document as XHTML1 instead - or, change your HTML4 doctype to an XHTML1 doctype instead As far as what the validator seems to *think* the problem is: It seems to be saying that the problem is due to that fact that you are using XML/XHTML self-closing tag syntax in a document that you are trying to validate as an HTML4 document (instead of as an XHTML1 document). If you want to validate your document as HTML4, I guess the only way to "fix" that is to not use self-closing tag syntax. But if you manually validate it as XHTML1, the only error the validator will emit is: Line 15, Column 25: document type does not allow element "h1" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag ...which is a real error in your document, regardless of what doctype you try to validate it against. Because you have this: <span id="lblMain"><h1>Canadian Banks</h1></span> ...and h1 is not allowed as a child of span. --Mike P.S. If you want to know the details about why the validator is emitting the particular error report that it's emitting, look closely at the explanation it gives for 'document type does not allow element "META" here' error it's emitting for line 7: One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error). So, it seems that because of a self-closing tag on some previous element, the validator is inferring that that the head section has already ended before it reaches the meta element for which it's emitting that message. I think this could arguably be considered a bug in the validator. Or maybe it's behavior that that's mandated by SGML or by something in the HTML4 spec. If so, it's arguably instead a bug in SGML or in the HTML4 spec. Because as far as actual browser parsing behavior goes, there's nothing in your source that would cause a browser to think that your head element is not still open at the point where the validator emits that message. -- Michael(tm) Smith http://people.w3.org/mike
Received on Monday, 8 November 2010 08:51:49 UTC