Java Reference
In-Depth Information
import org.xml.sax.*;
public class RSS
{
/*
* All of the attributes for this RSS document.
*/
private Map<String, String> attributes = new HashMap<String,
String>();
/*
* All RSS items, or stories, found.
*/
private List<RSSItem> items = new ArrayList<RSSItem>();
/**
* Simple utility function that converts a RSS formatted date
* into a Java date.
* @param datestr The RSS formatted date.
* @return A Java java.util.date
*/
public static Date parseDate(String datestr)
{
try
{
DateFormat formatter =
new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
Date date = (Date) formatter.parse(datestr);
return date;
} catch (Exception e)
{
return null;
}
}
/**
* Load the specified RSS item, or story.
* @param item A XML node that contains a RSS item.
*/
private void loadItem(Node item)
{
RSSItem rssItem = new RSSItem();
rssItem.load(item);
items.add(rssItem);
}
Search WWH ::




Custom Search