Element Declarations

Now that you know how to associate element and attribute declarations with a document, you need to understand what these declarations look like.

The <!ELEMENT> markup tag is used to declare what type of content is permitted for a particular element. For example, the following declaration from restaurant.dtd defines the markup that can appear inside an <item> element:

<!ELEMENT item (name, price, note?)?>

The first token following the <!ELEMENT> markup is the name of the element being declared (in this case, item). Following the name is either a simple regular expression that dictates the contents of the element, or a special keyword such as ANY (the element may contain any combination of other elements and text) or EMPTY ...

Get Strategic XML 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.