Re: Comments in markup?

galactus@stack.urc.tue.nl (Arnoud "Galactus" Engelfriet) writes:
>Yesterday I received an e-mail from someone who wanted to know more
>about HTML comments. I explained how they worked, and she then came
>up with the idea that you could embed comments in HTML tags then:
><A HREF="foo" -- A link to foo -->click here</A> would, according to
>her, be technically legal. Webtechs[0] didn't agree.
>
>When I tested this myself, I found out I couldn't use any SGML constructs
>other than DOCTYPES or comment elements in an HTML document when feeding
>it to the Webtechs validator. Is there a reason for this? Why would an
>SGML parser allow <!-- foobar --> but not <!ENTITY foobar ...>, both of
>which are valid SGML constructs?

Comments are only allowed in declarations. And the only declarations within
HTML document instances you'll find are comment declarations -- all the
rest is considered markup. You'll note that you can't put <!ENTITY ..>
declarations within the document instance either.

Murray

```````````````````````````````````````````````````````````````````````````````
     Murray Altheim, Program Manager
     Spyglass, Inc., Cambridge, Massachusetts
     email: <mailto:murray@spyglass.com>
     http:  <http://www.stonehand.com/murray/murray.html>
            "Give a monkey the tools and he'll eventually build a typewriter."

Received on Monday, 29 July 1996 17:13:20 UTC