CARLETON UNIVERSITY 
SCHOOL OF COMPUTER SCIENCE

95.205 C/D, WINTER 2001


ASSIGNMENT 4

Submission Instructions

Print a copy of the answer sheet and use it to hand in your answers to the assignment.
 

Questions

RSS (Resource Subscription Specification) is a format adopted by a large number of news sources on the Web to represent news headlines. For example, the following RSS file was downloaded from the Wired News site:

<?xml version="1.0" ?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
            "http://my.netscape.com/publish/formats/rss-0.91.dtd"><rss version="0.91">
<channel>
  <title>Wired News</title>
  <link>http://www.wirednews.com/</link>
  <description>Technology, and the way we do business, is changing the world we know. Wired News is a technology - and business-oriented news service feeding an intelligent, discerning audience. What role does technology play in the day-to-day living of your life? Wired News tells you. How has evolving technology changed the face of the international business world? Wired News puts you in the picture.</description>
  <language>en-us</language>
  <pubDate>Tue, 20 March 2001 15:39 PST</pubDate>

  <image>
  <title>Wired News</title>
  <url>http://static.wired.com/news/images/netcenterb.gif</url>
  <link>http://www.wirednews.com/</link>
  </image>

  <item>
  <title>Libraries: Filter Out Filters</title>
  <link>http://www.wirednews.com/news/politics/0,1283,42522,00.html</link>
  <description>Librarians and free speech activists are trying to reverse a new federal law that could cost libraries public money if they don't install filtering software. Declan McCullagh reports from Washington.</description>
  </item>

  <item>
  <title>Salon Sans Ads: It'll Cost You</title>
  <link>http://www.wirednews.com/news/business/0,1367,42524,00.html</link>
  <description>Struggling Salon.com hopes readers will support them one way or another. One way is to wade through ads unprecedented in size. Another is to pay $30 a year for a subscription. By Aparna Kumar.</description>
  </item>

...

</channel>
</rss>

The current list of news headlines from newsforge.com can be accessed from this link.

Install the JavaServer Web Development Kit (JSDWK 1.0.1) as per installation instructions in class.

Then answer the following questions:

a)    Write a DTD for the RSS document given as example above. Note: This will be a subset of the official RSS DTD, which you can get from the URL specified in the DOCTYPE. Elements and attributes that don't appear in the example document don't need to be supported by your DTD.

b)    Write a subclass of HandlerBase named RSSHandler for handling events generated by parsing an RSS document as specified by your DTD. The handler should create an object of type RSSChannel, which stores the contents of the RSS document. Note: You will have to define this class, and provide appropriate accessors.

c)    Write a servlet that  reads an RSS document from a news feed (use the Wired News link provided above), creating an RSSChannel object, and returns a web page similar to the following:


Wired News