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

Description

An element type has element content when elements of that type must contain only child elements (no character data), optionally separated by white space.

DTD


The root element XXX must contain precisely one element AAA followed by one element BBB. Elements AAA and BBB can contain some text but no other elements:

<!ELEMENT XXX (AAA , BBB)>
<!ELEMENT AAA (#PCDATA)>
<!ELEMENT BBB (#PCDATA)>

Valid documentsTop


A valid document containing some text:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
<AAA>Start</AAA>
<BBB>End</BBB>
</XXX>

This document is also valid:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> <AAA/> <BBB/> </XXX>

Documents with errorsTop


Element BBB is missing:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> <AAA/> ___ </XXX>

Element BBB must follow element AAA:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> <BBB/> <AAA/> </XXX>

Root element XXX can contain only one element BBB:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> <AAA/> <BBB/> <BBB/> </XXX>

Root element XXX must not contain any text.:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> Elements: <AAA/> <BBB/>  </XXX>