Processing of structured documents, Session 2 (3.-4.2.)



  1. 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)>
    

  2. 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.

    1. <attribute name="security" type="xsd:string">
    2. <attribute name="security" type="xsd:string" use="required">
    3. <attribute name="security" type="xsd:string" use="required" fixed="secret">
    4. <attribute name="security" type="xsd:string" use="optional">
    5. <attribute name="security" type="xsd:string" use="optional" fixed="secret">
    6. <attribute name="security" type="xsd:string" use="optional" default="secret">
    7. <attribute name="security" type="xsd:string" use="prohibited">

    Instances of the element 'chapter':

    1. <chapter>...</chapter>
    2. <chapter security="secret">...</chapter>
    3. <chapter security="normal">...</chapter>

    You might find the Table 1 of the XML Schema Part 0:Primer (Section 'Occurrence Constraints') helpful.

  3. Project, Part 2:


Helena Ahonen-Myka
Last modified: Thu Jan 30 08:57:42 EET 2003