W3C home > Mailing lists > Public > www-validator@w3.org > June 2005

Re: Strange Error Message

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Sun, 26 Jun 2005 12:01:41 +1000
Message-ID: <42BE0C85.5040105@lachy.id.au>
To: Barry Welford <smm@videotron.ca>
CC: www-validator@w3.org

Barry Welford wrote:
> Greetings
> I have a strange error message that is baffling me.
> I am checking this page
> http://www.strategicmarketingmontreal.ca/newslettere.htm
> The only two errors are not correct since there are opening tags
> corresponding to the two closing tags, which it identifies.

They are correct.  You simply misunderstand the reason for them.

| 65: <a href=http://www.google.com/search>
| 66: <img src=http://www.google.com/logos/Logo_40wht.gif border=0 
alt="Google" align="middle"></a>

According to the rules of HTML and SGML, that code is precisely 
equivalent to the following:

<a href="http:"></a>www.google.com/search>
<img src="http:">/www.google.com/logos/Logo_40wht.gif border=0 
alt="Google" align="middle"></a>

The reason for that is because of an SGML feature called SHORTTAG NET 
(Null End-Tag), where the first slash (/) is the NET-enabling start-tag 
and the second is the null end-tag.  For empty elements, such as img, 
the second slash is not used for the same reason you don't type </img>.

i.e. <element// is exactly the same as <element></element>

However, because no browsers actually implement that feature, the 
practical result you get happens to be what you intended.  To fix this 
error, you need to quote the href attribute in the a element and the src 
attribute in the img element.  Although it is much easier if you just 
quote *all* attribute values, regardless of whether you actually need to 
or not.

> In fact this is all part of some code provided by Google to allow a search
> function on the web page.

Google is not renowned for publishing valid, standards compliant code.

Lachlan Hunt
Received on Sunday, 26 June 2005 02:01:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:58:51 UTC