CSCI.4220 Network Programming
Spring, 2005
Programming Assignment 4

Write a java program that reads and parses two xml files. The first file defines some courses. Here is the DTD for it.

<!ELEMENT courselist (course)+>
<!ELEMENT course (coursename, coursenum, instructor, time)>
<!ELEMENT coursename (#PCDATA)>
<!ELEMENT coursenum (#PCDATA)>
<!ELEMENT instructor (#PCDATA)>
<!ELEMENT time (#PCDATA)>

The second file consists of a list of students. Here is the DTD for it

        
<!ELEMENT studentlist (student)+>
<!ELEMENT student (lastname, firstname, major, class+)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT major (#PCDATA)>
<!ELEMENT class (#PCDATA)>

The values for class in the latter file will be course numbers, i.e. drawn from the same set of strings as coursenum in the first file.

You are to generate an xml file for each course. Here is the DTD for this file.

<!ELEMENT courseinfo (coursename, coursenum, instructor, roster)>
<!ELEMENT coursename (#PCDATA)>
<!ELEMENT coursenum (#PCDATA)>
<!ELEMENT instructor (#PCDATA)>
<!ELEMENT roster (student)+>
<!ELEMENT student (lastname, firstname)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>

The names of the xml files should be created by concatenating the suffix .xml to the coursenums.

Your program should be written in java using the dom parser.

The project is due at midnight on Sunday April 3.