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

Re: Leading spaces inside of a tag?

From: Masayasu Ishikawa <mimasa@w3.org>
Date: Mon, 10 Sep 2001 06:33:34 +0900 (JST)
Message-Id: <20010910.063334.44701655.mimasa@w3.mag.keio.ac.jp>
To: jap3003@ksu.edu
Cc: www-validator@w3.org
It seems no one responded, so I would try ...

Joseph Pingenot <jap3003@ksu.edu> wrote:

> I had a page validate as HTML 4.01, but have a space between the <
>   and the img.  That is, I had (approximately):
>   < img src="blar.jpg">
>   validate.  However, it refused to render under any browser available
>   to me (IE 6, Mozilla 0.9.3, and Netscape 4.78).  Is whitespace
>   allowed between the leading < and the tag text, or is it a validator
>   bug?

White space is not allowed between the leading < (a.k.a. STAGO in SGML
terminology) and the element name, however, this is NOT a validator bug.

In SGML, when < is not followed by name characters, < is not treated as
STAGO but just character data, so in your example, `< img src="blar.jpg">'
is not treated as markup but as character data `<', a white space and
the text string `img src="blar.jpg">'.  So long as #PCDATA is allowed
there in a specified DTD, it just validates, but the result will not be
what you intended, as browsers (correctly) rendered them as just text

Note that in XML, when < is not used for markup, it must always be
escaped, so (pseudo) markup like `< img src="blar.jpg"/>' will cause
a well-formedness error.

Hope this helps.

Masayasu Ishikawa / mimasa@w3.org
W3C - World Wide Web Consortium
Received on Sunday, 9 September 2001 17:33:49 UTC

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