Essential XML for Web Professionals by Dan Livingston Essential XML for Web Professionals by Dan Livingston
Chapter Navigation Map

Chapter 3
Defining XML: DTDs

Examples

What are DTDs?

DTDs are files or chunks of code that determine how some XML must be structured and the names of all the tags and attributes that can be used.

Here are some examples of defining an element:

<!ELEMENT shirt_list (shirt*)>
<!ELEMENT shirt (size, color)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT color (#PCDATA)>

and some examples of how to define an attribute:

<!ATTLIST shirt quantity CDATA #IMPLIED>
<!ATTLIST shirt quantity CDATA #REQUIRED>
<!ATTLIST shirt quantity CDATA "1">

Prentice Hall PTR home | Essential Series home
© 2002 Prentice Hall PTR
13 12 11 10 9 8 7 6 5 4 3 2 1