Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Update the RSS Reader program you wrote for the previous project so that it reads multiple RSS feeds and generates the same nicely formatted HTML

Update the RSS Reader program you wrote for the previous project so that it reads multiple RSS feeds and generates the same nicely formatted HTML page of links for each feed, plus an HTML index page with links to the individual feed pages.

Your new program should ask the user for the name of an XML file containing a list of URLs for RSS v2.0 feeds (see below for the format of this file) and for the name of an output file in which to generate an HTML page with links to the pages for the individual RSS feeds (see below for an example). It should then read the input XML file into an XMLTree object and then process the list of RSS feeds from the XMLTree. For each RSS feed, the program should generate an HTML page with a table of links to all the news items in the feed (just like in the previous project). The program should also generate an HTML page with an index of links to the individual feed pages.

Format of the Input XML Document

The input XML document is pretty simple. This is the general structure:

1

2

3

4

5

6



file="name of HTML file for feed" />


...



The top-level tag, , has a required attribute, title, whose value is the title to be used in the index page; nested inside the top-level tag are 1 or more tags with the following required attributes: url, the URL of the RSS feed, name, the name to use for the link to the feed in the index page, and file, the name of the HTML file in which to generate the feed's table of links to news items (with the same format as the output in the previous project).

Here is an example of a valid XML input file.

Format of the HTML Output Index Page

The HTML index page should include the following information:

the title as the page title

a header with the page title inside

an unordered list where each item is the name of a feed linked to the feed URL

You can see an example of the index output here.

Method

Create a new Eclipse project by copying your RSSReader project and name the new project RSSAggregator.

Open the src folder of this project and then open (default package). Rename the RSSReader.java file to RSSAggregator.java. Open the RSSAggregator.java file in the editor.

Edit RSSAggregator.java to satisfy the problem requirements stated above. You should factor out the code in your previous project that processed the RSS feed into the following separate static method:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

/**

* Processes one XML RSS (version 2.0) feed from a given URL converting it

* into the corresponding HTML output file.

*

* @param url

* the URL of the RSS feed

* @param file

* the name of the HTML output file

* @param out

* the output stream to report progress or errors

* @updates out.content

* @requires out.is_open

* @ensures

* [reads RSS feed from url, saves HTML document with table of news items

* to file, appends to out.content any needed messages]

*


*/

private static void processFeed(String url, String file, SimpleWriter out) {...}

Step by Step Solution

3.48 Rating (168 Votes )

There are 3 Steps involved in it

Step: 1

mport componentssimplereaderSimpleReader import componentssimplereaderSimpleReader1L import componentssimplewriterSimpleWriter import componentssimplewriterSimpleWriter1L import componentsxmltreeXMLTr... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Social Statistics For A Diverse Society

Authors: Chava Frankfort Nachmias, Anna Leon Guerrero

7th Edition

148333354X, 978-1506352060, 1506352065, 978-1483359687, 1483359689, 978-1483333540

More Books

Students also viewed these Finance questions

Question

Give codons for the following amino acids: (a) Th (b) Asp (c) Thr

Answered: 1 week ago