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

Description

If an element name in DTD is followed by the star [*], this element can occur zero, once or several times.

DTD


The root element XXX can contain zero or more elements AAA followed by precisely one element BBB. Element BBB must be always present.:

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

Valid documentsTop


A valid document:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

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

Another valid document. The element AAA is not mandatory.:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> <BBB/> </XXX>

Several AAA elements can occur inside the document:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

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

Documents with errorsTop


Element BBB is missing:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX> ___ </XXX>

Element BBB must follow element AAA:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

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

Element AAA must not follow element BBB:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

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