p. 319: There's a [
missing from the first line of all the IGNORE
and INCLUDE
sections on this page. For instance, the first code fragment should be:
<![ IGNORE [
declarations that are ignored
]]>
instead of
<![ IGNORE
declarations that are ignored
]]>
The entire page should read:
Conditional Sections in DTDs
When developing DTDs or documents, you may need to comment out parts of the DTD not yet reflected in the documents. In addition to using comments directly, you can omit a particular group of declarations in the DTD by wrapping it in an
IGNORE
directive. The syntax follows:<![ IGNORE [ declarations that are ignored ]]>
As usual, white space doesn't really affect the syntax, but you should keep the opening
<![ IGNORE [
and the closing]]>
on separate lines for easy viewing.You can ignore any declaration or combination of declarations ‹ elements, entities, attributes, or even other
IGNORE
blocks ‹ but you must ignore entire declarations. TheIGNORE
construct must completely enclose the entire declarations it removes from the DTD. You cannot ignore a piece of a declaration (such as theNDATA GIF
in an unparsed entity declaration).You can also specify that a particular section of declarations is included ‹ that is, not ignored. The syntax for the INCLUDE directive is just like the IGNORE directive but with a different keyword:
<![ INCLUDE [ declarations that are included ]]>
When an
INCLUDE
is inside anIGNORE
, theINCLUDE
and its declarations are ignored. When anIGNORE
is inside anINCLUDE
, the declarations inside theIGNORE
are still ignored. In other words, an INCLUDE never overrides anIGNORE
.Given these conditions, you may wonder why
INCLUDE
even exists. No DTD would change if allINCLUDE
blocks were simply removed, leaving only their contents.INCLUDE
appears to be completely extraneous. However, there is one neat trick with parameter entity references and bothIGNORE
andINCLUDE
that you can't do withIGNORE
alone. First, define a parameter entity reference as follows:
<!ENTITY % fulldtd "IGNORE">
You can ignore elements by wrapping them in the following construct:
<![ %fulldtd; [ declarations ]]>