Re: Comments in markup?

galactus@stack.urc.tue.nl (Arnoud "Galactus" Engelfriet) wrote:

> Ah, ok. But why does the WebTechs validator complain when I feed an
> HTML document containing an <!ENTITY> declaration (copied from the
> HTML 3.2 DTD, but with a different name to avoid duplicates) to it?
> Shouldn't it be possible to declare new entities in an HTML document?
> 
> Or is there simply a restriction on *where* such declarations may be
> used?


Yes:  ENTITY, ELEMENT, and ATTLIST declarations can only
appear inside a document type definition.

To add local entity declarations to an SGML document,
you can put them in the DTD _internal subset_, a la:

	<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"
	[
	    <!ENTITY foo "replacement text here...">
	    <!ENTITY bar SYSTEM "http://www.wherever.com/whatever">
	]>
	<html>
	<head><title>...</title></head>
	<body>
	<p>&foo; &bar;
	</body>
	</html>

The only declarations that are legal in the document instance
are comment declarations and <!USEMAP> declarations (don't ask :-);
plus the initial <!SGML ...>, <!DOCTYPE ...>, and optional <!LINKTYPE ...>
declarations, which must precede the instance.



--Joe English

  joe@art.com

Received on Tuesday, 30 July 1996 13:47:15 UTC