Programming Assignment 5
Due on Wednesday March 31 before midnight
Using XPath and XSLT
This project must be done individually. No copying is permitted. The goal of this project is to
learn XPath and XSLT to query XML data and display XML data on a web browser.
You will do this project on your own PC/laptop. You may use a text editor to develop your Java programs
but you can use Netbeans if you want.
Here are some examples:
The following web pages provide some tutorials. Use them as a reference only.
- Consider the following XML document along with its DTD that describes auctions:
(The words for text paragraphs are taken from Shakespeare's plays.)
Download the file xpath.java and edit it to include the following XPath queries:
- Return the initial increases of all open auctions (this is the increase value of the first bidder in an open auction).
Note that dates in bids are random. The order of bids is exactly the order of bidders inside an open auction.
- How many sold items cost more than 40?
- How many items are listed in Europe?
- Print the keywords in emphasis in annotations of closed auctions.
- Print the persons who have a homepage.
- Return the IDs of all open auctions whose current increase is at least twice as high as the initial increase
(note that these are the increases of the last and first bidders of the same open auction).
That is, for a given open auction, if the increase of the last bidder is greater than twice the increase of the first bidder,
you return the ID of this open auction.
- Consider the following XML document along with its DTD that describes recipes:
Write an XSLT program 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.
Last modified: 03/30/10 by Leonidas Fegaras