Using Conditional Sections

One interesting feature of DTDs that you may find useful from time to time is conditional sections, which allow you to conditionally include or exclude code within a DTD. This can be helpful during the DTD development phase. Conditional sections are specified using the IGNORE and INCLUDE keywords, which cause code within a section to be ignored or included. You can alter the inclusion of the code in the DTD simply by changing the designation of the section containing the code with the IGNORE and INCLUDE keywords. The following is a section of code that is designated to be ignored by an XML processor:

<![IGNORE [
<!ELEMENT title (#PCDATA)>
<!ELEMENT track (#PCDATA)>
]]>

In this example, the title and track elements ...

Get XML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.