Question: import components.simplereader.SimpleReader; import components.simplereader.SimpleReader1L; import components.simplewriter.SimpleWriter; import components.simplewriter.SimpleWriter1L; import components.xmltree.XMLTree; import components.xmltree.XMLTree1; /** * Program to convert an XML RSS (version 2.0) feed from a
import components.simplereader.SimpleReader; import components.simplereader.SimpleReader1L; import components.simplewriter.SimpleWriter; import components.simplewriter.SimpleWriter1L; import components.xmltree.XMLTree; import components.xmltree.XMLTree1; /** * Program to convert an XML RSS (version 2.0) feed from a given URL into the * corresponding HTML output file. * * @author Put your name here * */ public final class RSSReader { /** * Private constructor so this utility class cannot be instantiated. */ private RSSReader() { } /** * Outputs the "opening" tags in the generated HTML file. These are the * expected elements generated by this method: * * * * the channel tag title as the page title * * * the page title inside a link to the link
* the channel description
* | Date | *Source | *News | *
|---|
* * * * @param out * the output stream * @updates out.contents * @requires out.is_open * @ensures out.content = #out.content * [the HTML "closing" tags] */ private static void outputFooter(SimpleWriter out) { assert out != null : "Violation of: out is not null"; assert out.isOpen() : "Violation of: out.is_open"; /* * TODO: fill in body */ } /** * Finds the first occurrence of the given tag among the children of the * given {@code XMLTree} and return its index; returns -1 if not found. * * @param xml * the {@code XMLTree} to search * @param tag * the tag to look for * @return the index of the first child of type tag of the {@code XMLTree} * or -1 if not found * @requires [the label of the root of xml is a tag] * @ensures
* getChildElement = * [the index of the first child of type tag of the {@code XMLTree} or * -1 if not found] * */ private static int getChildElement(XMLTree xml, String tag) { assert xml != null : "Violation of: xml is not null"; assert tag != null : "Violation of: tag is not null"; assert xml.isTag() : "Violation of: the label root of xml is a tag"; /* * TODO: fill in body */ } /** * Processes one news item and outputs one table row. The row contains three * elements: the publication date, the source, and the title (or * description) of the item. * * @param item * the news item * @param out * the output stream * @updates out.content * @requires * [the label of the root of item is an * out.content = #out.content * * [an HTML table row with publication date, source, and title of news item] *
*/ private static void processItem(XMLTree item, SimpleWriter out) { assert item != null : "Violation of: item is not null"; assert out != null : "Violation of: out is not null"; assert item.isTag() && item.label().equals("item") : "" + "Violation of: the label root of item is an 
The Problem 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 including the .html extension, 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. Input: RSS 2.0 XML Document 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: - The children of the tag and of the tag can occur in any order; do not assume they will appear in the order above. Furthermore there can be other children of other types not listed above. - , , and are required children of the tag, i.e., you should assume they are present. However, and may be blank, i.e., they may not have any text child. - All the children of
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
