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

Description

An attribute of CDATA type can contain any character if it conforms to well formedness constraints. NMTOKEN type can contain only letters, digits and point [ . ] , hyphen [ - ], underline [ _ ] and colon [ : ] . NMTOKENS can contain the same characters as NMTOKEN plus whitespaces. White space consists of one or more space characters, carriage returns, line feeds, or tabs.

DTD


The attributes bbb and ccc must be always present, the attribute aaa is optional:

<!ELEMENT attributes (#PCDATA)>
<!ATTLIST attributes 
      aaa CDATA #IMPLIED
      bbb NMTOKEN #REQUIRED
      ccc NMTOKENS #REQUIRED>

Valid documentsTop


All required attributes are present and their values are of the correct type:

 <!DOCTYPE attributes SYSTEM "tutorial.dtd">

<attributes aaa="#d1" bbb="a1:12" ccc=" 3.4 div    -4"/>

All required attributes are present and their values are of the correct type:

 <!DOCTYPE attributes SYSTEM "tutorial.dtd">

<attributes bbb="a1:12" 
ccc="3.4
div 
-4"/>

Documents with errorsTop


The character # is not permitted in attributes of type NMTOKEN and NMTOKENS:

 <!DOCTYPE attributes SYSTEM "tutorial.dtd">

<attributes aaa="#d1" bbb="#d1" ccc="#d1"/>

The space character is forbiden in attributes of NMTOKEN type:

 <!DOCTYPE attributes SYSTEM "tutorial.dtd">

<attributes bbb="A B C" ccc="A    B    C"/>