rss.parser
Class RSSParser

java.lang.Object
  extended by rss.parser.RSSParser

public class RSSParser
extends java.lang.Object

Contains static methods to parse RSS files. The parser is used to obtain feed information from a given URL or get FeedItems for a given Feed or URL. Note that when getting FeedItems from a Feed, the Feed's URL is used.

No calls are made to DataSource in this class.

Author:
Karl E. Rieb

Constructor Summary
RSSParser()
           
 
Method Summary
static Feed createFeedFromURL(java.lang.String feedURLString)
          Creates a Feed with its FeedItems from a given URL string.
static java.util.Collection<FeedItem> getFeedItems(Feed feed)
          Returns a Collection of FeedItem objects that were parsed from the given feed's URL.
static java.util.Collection<FeedItem> getFeedItems(java.net.URL feedURL)
          Returns a Collection of FeedItem objects that were parsed from the given RSS URL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSSParser

public RSSParser()
Method Detail

createFeedFromURL

public static Feed createFeedFromURL(java.lang.String feedURLString)
                              throws java.io.IOException,
                                     UnsupportedRSSFormatException
Creates a Feed with its FeedItems from a given URL string.

Parameters:
feedURLString - String representing URL for the feed
Returns:
Feed object created from URL
Throws:
java.io.IOException - Thrown if an error occurs reading the URL
UnsupportedRSSFormatException - Thrown if RSS XML file is unsupported by the parser.

getFeedItems

public static java.util.Collection<FeedItem> getFeedItems(java.net.URL feedURL)
                                                   throws java.io.IOException,
                                                          UnsupportedRSSFormatException
Returns a Collection of FeedItem objects that were parsed from the given RSS URL.

Parameters:
feedURL - URL of the RSS XML file
Returns:
Collection of FeedItem objects from the XML file
Throws:
java.io.IOException - Thrown if an error occurs reading feedURL
UnsupportedRSSFormatException - Thrown if XML file is unsupported by the parser.

getFeedItems

public static java.util.Collection<FeedItem> getFeedItems(Feed feed)
                                                   throws java.io.IOException,
                                                          UnsupportedRSSFormatException
Returns a Collection of FeedItem objects that were parsed from the given feed's URL.

Parameters:
feed - Feed to containing URL to RSS file
Returns:
Collection of FeedItems that belong to the given feed
Throws:
java.io.IOException - Thrown if an error occurs reading the RSS file associated with the feed
UnsupportedRSSFormatException - Thrown if RSS file is unsupported by the parser.