Example 9     <<      >>       intro       contents     

Attributes are used to associate name-value pairs with elements. Attribute specifications may appear only within start-tags and empty-element tags. The declaration starts with ATTLIST then follows the name of the element the attributes belong to and then follows the definition of the individual attributes.

  DTD   HOME     

An attribute of CDATA type can contain any character if it conforms to well formedness constraints. The required attribute must be always present, the implied attribute is optional:

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


  Valid documents   HOME     

CDATA attribute can contain any character conforming to well-formedness constraints:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <attributes aaa="#d1" bbb="*~*">
                    Text
               </attributes>
               
            

The order of attributes is not important:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <attributes bbb="$25" aaa="13%">
                    Text
               </attributes>
               
            

The bbb attribute can be omitted as it is implied:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <attributes aaa="#d1" />
               
            

  Documents with errors   HOME     

The aaa attribute is required. Therefore it must be always present.:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <attributes ___ bbb="X24"/>