>> English << | česky | Español | По-русски | Français | Italiano | Deutsch | MagyarZVON > Tutorials > DTD Tutorial
>> Example 15 << | Prev | Next | Contents

Description

An element can be defined EMPTY. In such a case it can contain only attributes but no text.

DTD


The AAA elements can contain only attributes but no text:

<!ELEMENT XXX (AAA+)>
<!ELEMENT AAA EMPTY>
<!ATTLIST AAA 
      true ( yes | no ) "yes">
   

Valid documentsTop


Both these forms are allowed. In the second case the ending tag must immediately follow the starting one:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
   <AAA true="yes"/>
   <AAA true="no"></AAA>
</XXX>

Documents with errorsTop


The AAA element must not contain any text and the starting tag must be immediately closed:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
   <AAA true="yes"/>
   <AAA true="no"></AAA>
   <AAA>      </AAA>
   <AAA>Hello!</AAA>
</XXX>