A schema definition language for XML

Declaration

  1. Element <>

Element Declaration

<!ELEMENT book (title, author*, publisher?, year?, section*)>
  • the element book must contain the following child elements, in order:
    1. one title
    2. zero or more authors
    3. zero or one publisher
    4. zero or one year
    5. zero or more sections
<!ELEMENT p (#PCDATA | p | ul | dl | table | h1 | h2 | h3)* >
  • element p may contain:
    • {dtd}#PCDATA pure text only (no child elements)
    • p elements
    • ul elements
    • etc.
    • * → and zero or more repetitions of them.

Attribute Declaration

<!ATTLIST img
   src    CDATA          #REQUIRED
   id     ID             #IMPLIED
   sort   CDATA          #FIXED "true"
   print  (yes | no)     "yes"
>
  • Type is…
  • Value is…
    • #REQUIRED: necessary
    • #IMPLIED: optional
    • #FIXED: constant
    • ⇒ “Final column "default": default value of that attribute