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

From Wikibooks, open books for an open world
Jump to navigation Jump to search

XML


4. The one-to-one relationship[edit | edit source]

Answers[edit | edit source]

Exercises[edit | edit source]

Exercise 1[edit | edit source]

  1. Create an XML schema to describe the most popular restaurant in a city. Use either the all order indicator or the choice order indicator in your schema. Check that it is well-formed and valid.
  2. Using the schema, create an XML document and populate it with data for one city that has a most popular restaurant as well as two or more other restaurants. Check that it is well-formed and valid.
  3. Write an XML style sheet to display the most popular restaurants sorted by name if the restaurant is located in a city with population > 5,000.

Exercise 2[edit | edit source]

  1. Create and XML schema to represent the most popular professors at a university. Include first name, last name, and years teaching.
  2. Using the XML schema, create and XML document and populate it with data about a university and its most popular professor. Use at least three universities and two professors at each university.
  3. Write and XML style sheet to display the most popular professors at each school sorted by the professor names.

Answers[edit | edit source]