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

Element Declarations

To declare the syntax of an element in a DTD, you use the <!ELEMENT> element like this: <!ELEMENT NAME CONTENT_MODEL>. Here, NAME is the name of the element you're declaring; CONTENT_MODEL can be set to EMPTY or ANY, or it can hold mixed content (other elements as well as parsed character data) or child elements.

Here are a few element examples—note the expressions starting with % and ending with ;. Those expressions are parameter entity references, much like general entity references, except that you use them in DTDs, not the body of the document (we'll see parameter entities in the next chapter):

 <!ELEMENT direction (left, right, top?)> <!ELEMENT CHAPTER (INTRODUCTION, (P | QUOTE | NOTE)*, DIV*)> <!ELEMENT HR EMPTY> <!ELEMENT ...

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