XML Course-Catalog Data Exercises


In these exercises (and the companion query exercises), you are working with a sample data set drawn from the Stanford course catalog. There are multiple departments, each with a department chair, some courses, and professors and/or lecturers who teach courses. Two different versions are provided: the first (courses-noID.xml) encodes the data without using ID and IDREF(S) attributes, and the second (courses-ID.xml) uses ID and IDREF(S).

For more information on how to check your DTDs and XML Schema specifications against these files, please see our quick guide to XML validation and querying.

No answers are provided for these exercises. If your DTD or XSD validates against the XML data set with no errors, then it is correct.


1.  Write a DTD that is valid with respect to the courses-noID.xml data.

2.  Write a DTD that is valid with respect to the courses-ID.xml data. (You may want to use your DTD from the previous question as a starting point, since the structure is similar.)

3.  If you are brave, try writing XML Schema specifications for the data sets; beware they will be fairly long and cumbersome, as seen in the provided examples.