Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your 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

Your 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.

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


1

2

3

4

5

6

<feeds title="Title for index page">

<feed url="the feed source URL" name="name of feed for index page"

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

<feed url="..." name="..." file="..." />

...

</feeds>

The top-level tag, <feeds>, 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 <feed> 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<feeds> 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.

*

* @paramurl

* 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 <pre>

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

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

* </pre>

*/

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

Step by Step Solution

3.53 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

importcomponentssimplereaderSimpleReader 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

Operating Systems Internals and Design Principles

Authors: William Stallings

8th edition

133805913, 978-0133805918

More Books

Students also viewed these Programming questions

Question

What is the relative influence of each member of the group? lPO05

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago

Question

Define the two main categories of processor registers.

Answered: 1 week ago