SGML Content Exclusion and Inclusion

 <  Day Day Up  >  


Occasionally, the need arises to declare that an element type cannot contain certain other element types. This is known as a content exclusion . The excluded tags follow the model group , enclosed by parentheses and preceded by the minus sign under an SGML doctype:

  (model group) -(excluded tags)  

A related special need is the capability to declare that an element type can occur anywhere inside a content model. This is known as a content inclusion . The included tags follow the model group, and are enclosed by parentheses and preceded by the plus sign:

  (model group) +(included tags)  

As an example, the HTML 4.0 declaration for the <BODY> tag illustrates both excluded and included elements:

  <!ELEMENT BODY O O (%block;) -(BODY) +(INSDEL)>  

Why are insertions and deletions used in this declaration? The content inclusion says that the <INS> and <DEL> tags can occur anywhere in the content enclosed by <BODY> and </BODY> tags. While the content exclusion says that a BODY element cannot contain another BODY element, in this case it's necessary because of the curious " %block " declaration used in the model group. The leading % character identifies this as a parameter entity , essentially a macro symbol that refers to a longer character string declared elsewhere in the DTD. Parameter entities, which commonly occur in DTDs, are discussed shortly (see the section "Parameter Entities"). The " %block " entity reference is a shorthand way of referring to all block element types that happen to include <BODY> . It is easier to exclude <BODY> from the list of block elements than to define a special purpose declaration. Interestingly, XML eliminates the use of content inclusion and exclusion from the XHTML DTD, and thus it is both more verbose and in some ways simpler to read.



 <  Day Day Up  >  


HTML & XHTML
HTML & XHTML: The Complete Reference (Osborne Complete Reference Series)
ISBN: 007222942X
EAN: 2147483647
Year: 2003
Pages: 252
Authors: Thomas Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net