O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DTD Comments

As you can see, DTDs can become fairly complex, especially in longer and more involved documents. To make things easier for the DTD author, the XML specification allows you to place comments inside DTDs.

DTD comments are just like normal XML comments—in fact, they are normal XML comments, and they're often stripped out by the XML processor. (The W3C allows XML processors to remove comments, but some processors pass comments on to the underlying application.) Here's an example in which I have added comments to ch02_01.xml:

Listing . ch03_07.xml
 
<?xml version = "1.0" standalone="yes"?>
<!DOCTYPE DOCUMENT [
					<!-- DOCUMENT is the root element -->
					<!ELEMENT DOCUMENT (CUSTOMER)*>
					<!-- CUSTOMER stores customer data -->
					<!ELEMENT CUSTOMER ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required