O'Reilly logo

Special Edition Using XML, Second Edition by - et al. David Gulbransen

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

Element Declarations in DTDs

With an understanding of what valid XML is, and why we might want to take advantage of it, it's time to take a look at the physical constructs that make up a DTD. Let's go back to our first simple DTD example:

<!-- A Simple DTD --> 
<!ELEMENT inventory (item+)>
<!ELEMENT item (description, sku)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT sku (#PCDATA)>

This example is actually a complete and valid DTD. You will notice that unlike with XML, there is no prolog or any formal structure that identifies this as a DTD. We have added a comment line that identifies it, but there are no formal requirements or headers for DTDs.

The DTD itself will consist of a series of declarations, and the first declaration we're going to ...

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