XML DTD and XML Schema Discussion Sessions 1A and 1B Session 2
XML eXtensible Markup Language Colossus of Rhodes Greece 107 Great Pyramid of Giza Egypt 147
DTD Document Type Definition Meaning of *, +, and ? #PCDATA and CDATA Order of elements and attributes #REQUIRED and #IMPLIED
DTD Document Type Definition What about an empty element? Can we define an unsorted list of elements? An element with anything? Attributes with choices? Why to use attribute IDs? IDREF(S)?
DTD Document Type Definition Pros Compact structure Can be defined inline Wide support among parsers Cons Are not written in XML Don’t support Namespaces Don’t have data – typing Have limited capacity for counters
XML Schema Types of elements Simple type Complex type
XML Schema Simple Type Egypt Different ways to define this element: <xs:element name=”location" type="xs:string" /> <xs:element name="location" type="stringType" />...
XML Schema Complex Type Complex type Text + Attributes Elements + Attributes Attributes only Text + Elements + Attributes
XML Schema Complex Type: Simple Content 100 Just to generate this simple line!
XML Schema Complex Type: Complex Content 1 <xs:element name="wonder" type="wonderType" minOccurs="2" maxOccurs="unbounded"/> What does this segment of code do?
XML Schema Complex Type: Complex Content 2 <xs:attribute name="source" default="ancient.jpg" type="xs:string"/> An empty element that contains only attributes
XML Schema Complex Type: Complex Content 3 A mixed element that combines children elements, text, and attributes