A schema definition language for XML
Declaration
- Element
<>
Element Declaration
<!ELEMENT book (title, author*, publisher?, year?, section*)>- the element book must contain the following child elements, in order:
- one title
- zero or more authors
- zero or one publisher
- zero or one year
- zero or more sections
<!ELEMENT p (#PCDATA | p | ul | dl | table | h1 | h2 | h3)* >- element
pmay contain:{dtd}#PCDATApure text only (no child elements)pelementsulelements- 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…
ID: is the unique id of that element.- !
IDis globally unique, regardless of attribute name, element name, etc. - See xml - DTD - uniqueness of ID attributes - Stack Overflow
- !
IDREF: reference of some idCDATA: any string(val1|…): can only be either of these values.
- Value is…
#REQUIRED: necessary#IMPLIED: optional#FIXED: constant- ⇒ “Final column
"default": default value of that attribute