Programming Assignment 5
Using XPath and XSLT

Due on Thursday April 7 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). 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

    You will evaluate XPath and XSLT over XML data from the shopping.com API (the eBay Commerce Network API) for shopping, which you used in Project #3. More specifically:
    1. Write a plain Java program xpath.java that reads some search keywords from input, searches the eBay API for items in the category with id=72 (the computers category) that match these keywords, and displays information about these products by evaluating the following XPath queries over the returned XML data:
      1. Print the full description of all products that have a rating 4.50 or higher.
      2. Print the name and the minimum price of all products whose name contains the word Sony.
      3. Print the names of all products whose name contains the word Sony and the price is between $1000 and $2000, inclusive.
    2. Write an XSLT program search.xsl to display the search results by transforming the XML result to XHTML using XSLT that contains the components you generated for the search results in Project #3: the id, sourceURL, name, minPrice, and fullDescription. Use the Java program xslt.java to test your XSLT and then load the resulting html output file on your web browser.

    Note: To call a web service, use the java.net.URL class. To URL-encode the query string, use the java.net.URLEncoder class. For example, this calls the ISBN DB and prints the result.

What to Submit

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

Submit Project #5:

Last modified: 03/23/2016 by Leonidas Fegaras