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

Description


Text can be interspersed with elements.

DTD



The element AAA can contain either BBB or CCC. On the other hand the element BBB can contain any combination of text and CCC elements.:

<!ELEMENT XXX (AAA+ , BBB+)>
<!ELEMENT AAA (BBB | CCC )>
<!ELEMENT BBB (#PCDATA | CCC )*>
<!ELEMENT CCC (#PCDATA)>

Valid documentsTop



A valid document exploring several possibilities:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
   <AAA>
      <CCC>Precisely one element.</CCC> 
   </AAA>
   <AAA>
      <BBB>
         <CCC/>
         <CCC/>
         <CCC/>
      </BBB>
   </AAA>
   <BBB/>
   <BBB>
      This is <CCC/> a combination <CCC/> of <CCC> CCC elements </CCC> and text <CCC/>. 
   </BBB>
   <BBB>
      Text only. 
   </BBB>
</XXX>

Documents with errorsTop



The element AAA cannot contain any text.:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
   <AAA>
      Element: <CCC/>
   </AAA>
   <BBB>
      Element: <CCC/> 
   </BBB>
</XXX>