Re: Leading spaces inside of a tag?

Ah.  Thanks for the information.  It might be nice, though, even if it
  *is* valid, for the HTML validator to throw out a warning with the
  information you gave me.  :)
Nice illustration of one of the difference between SGML and XML, too.
Thanks again!


From Masayasu Ishikawa on Monday, 10 September, 2001:
>It seems no one responded, so I would try ...
>Joseph Pingenot <> 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 /
>W3C - World Wide Web Consortium

"The message that 'resistance is futile' has been hammered home.
  The only OS projects that stand a chance [against Microsoft] are
  open source, because they don't play by the rules of the economy."

Received on Monday, 10 September 2001 15:59:21 UTC