January 2003
Beginner to intermediate
1200 pages
23h 42m
English
The last remaining DTD content model is the empty-content model. In this case, the elements you declare cannot hold any content (either PCDATA or other elements).
Declaring an element to be empty is easy; you just use the keyword EMPTY, like this:
<!ELEMENT CREDIT_WARNING EMPTY>
Now you can use this new element, <CREDIT_WARNING>, like this:
<CREDIT_WARNING />
Note that although empty elements cannot contain any content, they can have attributes (such as the XHTML <img> element). We'll see how to add attributes to element declarations in the next chapter. Here's how I declare and put the <CREDIT_WARNING> element to work:
<?xml version = "1.0" standalone="yes"?> <!DOCTYPE DOCUMENT [ <!ELEMENT DOCUMENT (CUSTOMER)*> ... |