Convert the following DTD element declarations into an XML Schema. You can modify the types and structures as you feel reasonable.
<!ELEMENT report (header, body)> <!ELEMENT header (title, editors, authors, date)> <!ELEMENT title (#PCDATA)> <!ELEMENT editors (name, contact?)*> <!ELEMENT authors (name, contact?)+> <!ELEMENT name (#PCDATA)> <!ELEMENT contact (workplace, ((street?, postcode, city) | phone | email | fax)+) > <!ELEMENT workplace (#PCDATA)> <!ELEMENT street (#PCDATA)> <!ELEMENT postcode (#PCDATA)> <!ELEMENT city (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT email (#PCDATA)> <!ELEMENT fax (#PCDATA)> <!ELEMENT date (#PCDATA)> <!ELEMENT body (section+)> <!ELEMENT section (title, para+)> <!ELEMENT para (#PCDATA)>
Assume that an element 'chapter' has been declared as follows:
<xsd:element name="chapter"> <xsd:complexType> ... ... attribute declaration ... </xsd:complexType> </xsd:element>
Assume that the type definition above contains one attribute declaration from the list below at a time, and tell which of the given instances of the element 'chapter' (see below) are valid in that case. That is, give for each pair (e.g. 1-a) if it is valid or not.
Instances of the element 'chapter':
You might find the Table 1 of the XML Schema Part 0:Primer (Section 'Occurrence Constraints') helpful.
Project, Part 2:
Construct XML Schemas for the XML documents you designed in the Part 1.
Describe the possible differences between your DTDs and XML Schemas. Can you express some information, constraints, etc. better using XML Schemas? Are these features useful in your application (business-to-business data transfer)?
Validate your schema, e.g., using the XSV validator:.
<?xml version="1.0" encoding="UTF-8"?> <cards xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "http://www.cs.helsinki.fi/group/dime/rado/ k02/harj/02/cards.xsd" >