Jump to content

XML - Managing Data Exchange/The one-to-many relationship/Exercises

From Wikibooks, open books for an open world

Chapter

[edit | edit source]

To return to the chapter, follow this link: One-to-many relationship

1. Museum information

[edit | edit source]
  • a. Create an XML schema to describe a museum (use elements of the museum entity defined in the last chapter, and add to it a country element). Specify a set of acceptable values as a country and its calendar with date, opening time, and closing time.
  • b. Using the schema, create an XML document and populate it with data for two museums with at least 5 different dates in the calendar for one museum and 7 different dates for the other museum.

2. Currency codes for tourist guides

[edit | edit source]
  • a. Help the guides by creating a valid and well-formed XML schema describing currency codes (e.g. EUR for Euros). The currency code element should consist of three characters. Along that the country's name (e.g. Germany) and the name of the currency (e.g. Euros) should be included. Create a XML document in which some currency codes are listed.

3. The spa finder

[edit | edit source]
  • a. the XML schema - the Spa Finder lists many spas, each spa serves many activities, and each activity is offered at many days and times by different practitioners.
  * the information found for each spa - NAME,OWNER, PHONE, CITY, STATE, ADDRESS, STARTED IN, TYPE OF SPA 
  * the information found for each service - SERVICE, DESCRIPTION, PRICE 
  * the information found for each offering of a service - DAYS, TIMES, PRACTITIONER, FLOOR, ROOM 
  • Extra- you could use enumeration for the SERVICE, listing some pre-determined services (ie. European Facial, Avocado Facial, Hot Stone Massage, Reflexology, Accupressure, Yoga, TaiChi).
  • b. the XML document - fill in the data for 3 spas with at least 3 services each and at least 2 offerings of each service.

4. Movie Database

[edit | edit source]
  • Create an XML schema to depict a relationship between movie genres, movies, and actors/actresses.
  • Choose two genres (drama, horror, action, etc.), two movies in each, and several actors/actresses from each.
  • Using the schema, create a document and populate it with the chosen information.
  • Create an XML stylesheet to present the data for easier readability. Reference the stylesheet in the document.

Answers

[edit | edit source]

To view the answers, follow this link: answers