DTDs : definitions
Defining Elements PCDATA: Parsed character data i.e., any characters without further XML structure
Defining Elements Example:
Defining Elements: sequences Example: John Smith
Defining Elements: repetition and optionality <!ELEMENT name (first_name, middle_name*, last_name+)> ?Zero or one of the element *Zero or more of the element +One or more of the element
Defining Elements: choices <!ELEMENT digit (zero | one | two | three | four | five | six | seven | eight | nine | zero)> Example: stuff of some kind
Defining Elements: combinations <!ELEMENT circle (center, (radius | diameter)) > Examples: stuff of some kind 3m stuff of some kind 3m
Defining Elements: mixed content <!ELEMENT paragraph (#PCDATA | name | profession | footnote | emphasize | date )* > With this option, you cannot then count particular occurrences, nor can this appear as a sub- element in other definitions!
Defining Attributes Example: CDATA: character data
Attributes Types CDATA NMTOKEN : name token ID IDREF IDS IDREFS
Defining Attributes <!ATTLIST image source CDATA #REQUIRED alt CDATA #IMPLIED> Example: <image source=“my-picture.jpg” alt=“this is my picture”/>
ID Attributes Example: This is a difficult problem.
IDREF Attributes Example: This is a difficult problem.
IDREFS Attributes <!ATTLIST interesting turn IDREFS #REQUIRED> Example: This is a difficult problem.