next up previous
Next: About this document ...

Assignment #4
CpSc 372: Python Programming
Computer Science Department
Clemson University
Using XML and DTD documents
Brian Malloy, PhD
June 13, 2006



In order to receive credit for this assignment, your solution must be submitted, using the handin command, by 8 AM, Tuesday, June 20th, 2006. I will zip your files and move them to my directory at that time. You may submit your solution before the deadline as many times as you like; only your final submission will be considered. However, for multiple submissions, it's best to use the same names for files, since only those will be overwritten by your submission.

The purpose of this assignment is to help you to become familiar with using XML and DTD documents.

Your assignment is to extend your third assignment so that it checks the current ``root'' directory to see if there is a directory with the name .trash. If such a directory does not exist your program should create one, and if it does exist we will assume that this directory can contain two kinds of files:

  1. deleted files from previous usage of your file management program, stored using a mangled name, and
  2. an XML document describing the original location of the deleted files and a mangled name for the original file.

You can mangle the names in any manner that is convenient for you. Your program should generate an XML document that you will store in the .trash directory. Your XML document should conform to the DTD stored at the following location:

/home/malloy/public_html/courses/372-2006/xml/trash.dtd
/home/malloy/public_html/courses/372-2006/xml/trash.xml

A DTD is a Document Type Definition file that specifies the structure of an XML document. When a DTD is provided, some parsers (called validating parsers) read the DTD and check the XML document's structure to see if it conforms to the DTD specification. If an XML parser is able to parse the XML document, the document is considered to be well-formed. Your Python program should generate a well-formed XML description of the files stored in the .trash directory. If you typically work offline, then you can place the DTD file in your local directory but the ideal is to use the DTD stored on my directory.

To parse the XML document, you should use a the SAX parser included in Python. Examples of SAX parsing will be presented in class. Using your SAX parser, you can retrieve stored information about the original name and location of the deleted files in the .trash directory.

For this assignment, you will extend your third assignment 1so that files can be restored from the .trash directory across executions of your Python file management system. You are, essentially, modeling the Windows recycle bin.

Your program must be written in Python and must contain documentation in the form of a readme file. The readme should contain your name and other important information about you and the assignment; for example, what your assignment does, what it fails to do, anything extra or clever that you have done beyond the assignment specification, and how to run your program.

You must submit your assignment using the handin command.

Here is the handin command:

        handin.372.1 3 *




next up previous
Next: About this document ...
Brian Malloy 2006-06-13