Programming Assignment 6
Using XPath and XSLT

Due on Tuesday November 11 before midnight


Description

The goal of this project is to learn XPath and XSLT to query XML data.

This project must be done individually. No copying is permitted. Note: We will use a system for detecting software plagiarism, called Moss, which is an automatic system for determining the similarity of programs. That is, your program will be compared with the programs of the other students in class as well as with the programs submitted in previous years. This program will find similarities even if you rename variables, move code, change code structure, etc.

Note that, if you use a Search Engine to find similar programs on the web, we will find these programs too. So don't do it because you will get caught and you will get an F in the course (this is cheating). Don't look for code to use for your project on the web or from other students (current or past). Don't try to hire a freelancer to do the coding for you. Just do your project alone using the help given in this project description and from your instructor and GTA only.

Platform

You will do this project on your own PC/laptop. You may use a text editor to develop your Java programs but you may use an IDE, such as Eclipse or Netbeans, if you want.

Here are some examples:

Documentation

The following web pages provide some tutorials. Use them as a reference only.

Project Requirements

  1. Download the file xpath.java and edit it to include the following XPath queries. First, download the following XML document along with its DTD that describes journal articles: Note: the links are NOT broken. Just right click and use "Save Link As" to save the XML and DTD files on your PC.

    Insert XPath queries in xpath.java that answer the following:

    1. Print the titles of all articles whose one of the authors is David Maier.
    2. Print the titles of all articles whose first author is David Maier.
    3. Print the titles of all articles whose authors include David Maier and Stanley B. Zdonik.
    4. Print the titles of all articles in volume 19/number 2.
    5. Print the titles and the init/end pages of all articles in volume 19/number 2 whose authors include Jim Gray.
    6. Print the volume and number of all articles whose authors include David Maier. (note: we need the number entry of an article, not the number of articles).
  2. Consider the following XML document along with its DTD that describes recipes: Write an XSLT program recipe.xsl to display the recipes nicely on a web browser. The XSLT should generate HTML code. You should display all data except the related elements. Use the Java program xslt.java to test your XSLT and then load the resulting html output file on your web browser.

What to Submit

Use the form below to submit your files: xpath.java, recipe.xsl, xslt.java, and the HTML output of your xslt.java program.

Submit Project #6:

Last modified: 10/30/2014 by Leonidas Fegaras