More Projects

PROJECT 7: XML
(this project is worth 5% of the course grade)

 

In this project, you will use XML to enhance your movie database

The XML parser and DOM package for this project is the Apache/IBM Xerces library. It has already been installed at /WWW/xml/xerces.jar on gemini. To parse and manipulate a XML file and to learn the basic operations of xerces, please go to our Tutorial page.

The goal of the project is to take an external XML file containing movie data and import it into your database. This project thus simulates an Ecommerce web store that updates its online stocks using the XML technology from time to time.

1. An XML file and a DTD file has been put on our course web site at http://www.cs.sfu.ca/CC/470/qyang/pj7/store.xml and http://www.cs.sfu.ca/CC/470/qyang/pj7/store.dtd. These files simulate the new movies that are to be imported. Note that you cannot assume that all movies are new to your database; some may be duplicates. Pricing information for existing movies in your database may change too.

2. Parse and validate the XML file using the Xcerces, the DOM Parser. If the xml file is invalid, an appropriate error message shuld be generated.

Note: please use the DOM parser. We will not use the SAX parser in this project.

3. After parsing, the parser should give you a handle to the root of the DOM tree. Traverse this tree and store movies into your movie database.

The XML file may contain new and existing movies. New movie should be inserted into the database. Existing movies should be used to update the stock/quantities field of the database. The images of the movies should be shown to the users who visit your store. You can assume that the image URL's are all valid. The price of an existing movie in the XML should be taken as the most recent price.

4. In your store's entrance page, add a button/link titled "Administrator". This link takes you to a HTML form which allows one to enter a URL for an XML file. There is a "Import" button, which will execute the Java code above to import the XML file into the database. You don't need to password protect the Administrator button for this project.

You can assume that the same DTD is used. Thus, you don't need to import a new DTD here.

 

5. Hand in: Please include in your project table

  • a link to the store front
  • a link to your java file(s) stored in an HTML or .txt file. Highlight parts that are XML project specific.
  • a link to a brief documentation also in HTML or TXT (you can use javadoc for this). Only the file(s) related to XML manipulation is needed.

 

 

 

 

 

 

More Projects