Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

RSS (Really Simple Syndication) is an XML application for distributing web conte

ID: 3537174 • Letter: R

Question

RSS (Really Simple Syndication) is an XML application for distributing web content that changes frequently. Many news-related sites, weblogs and other online publishers syndicate their content as an RSS Feed to whoever wants it.

For this project your task is to write a program that asks the user for the URL of an RSS 2.0 feed and for the name of an output file, reads the RSS feed into an XMLTree object and then uses the information in the XMLTree object to generate in the output file a nicely formatted HTML page with table of links to all the news items in the original feed.

Here is a simplified description of the structure of an RSS 2.0 XML document. RSS 2.0 documents can contain a few other tags and features, but these are the ones you will need for the project.

Note the following properties of RSS 2.0 XML documents:

Note that when your program creates an XMLTree object from a given RSS 2.0 feed, if it is successful, all you know is that the input is a valid XML document. It is up to your program to check that the label of the root of the XMLTree is an <rss> tag and that it has a version attribute with value "2.0". After that, your program can assume that the input is indeed a valid RSS 2.0 feed and the XMLTree has the structure described above; in other words, you do not need to check for the existence of the <channel> tag, or the <title>, <link>, and <description> tags inside that. However, make sure you do not make any assumptions that are not specified in the structure described above.

These are the minimum requirements for the generated web page. If you think you can produce better output or include more information, you should consult your instructor to make sure that any changes you want to implement are acceptable. This is what your output should include:

You can see an example of the output here (note that the links may be outdated and no longer available).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <rss version="2.0">   <channel>     <title>Title goes here</title>     <link>Link goes here</link>     <description>Description goes here</description>     <item>       <title>Optional title goes here</title>       <description>Optional description goes here</description>       <link>Optional link goes here</link>       <pubDate>Optional publication date goes here</pubDate>       <source url="the source URL">Optional source goes here</source>       ...     </item>     ...   </channel> </rss>

Explanation / Answer


@param args
the command line arguments; unused here
/
public static void main(String[] args) {
SimpleReader in = new SimpleReader1L();
SimpleWriter out = new SimpleWriter1L();
out.println("Enter the URL of an RSS 2.0 feed: ");
XMLTree item = new XMLTree1(
"http://xml.weather.yahoo.com/forecastrss/43210.xml");
item.toString();
item.display();
String s = item.label();
if (s == "rss") {
String t = item.attributeValue("version");
if (t == "2.0") {
getChildElement(item, s);
}
}

/
TODO: fill in body
/

in.close();
out.close();
}

}