thufir

rome reader

Oct 3rd, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. package romeclient;
  2.  
  3. import com.sun.syndication.feed.synd.SyndCategoryImpl;
  4. import com.sun.syndication.feed.synd.SyndContentImpl;
  5. import com.sun.syndication.feed.synd.SyndEntry;
  6. import com.sun.syndication.feed.synd.SyndFeed;
  7. import com.sun.syndication.feed.synd.SyndLinkImpl;
  8. import com.sun.syndication.io.FeedException;
  9. import com.sun.syndication.io.SyndFeedInput;
  10. import com.sun.syndication.io.XmlReader;
  11. import java.io.IOException;
  12. import java.net.MalformedURLException;
  13. import java.net.URL;
  14. import java.util.List;
  15. import java.util.logging.Logger;
  16.  
  17. public class A {
  18.  
  19.     private static Logger log = Logger.getLogger(A.class.getName());
  20.  
  21.     public void foo() throws MalformedURLException, IllegalArgumentException, FeedException, IOException {
  22.         String na = "http://feed.nashownotes.com/rss.xml";
  23.         URL url = new URL(na);
  24.         SyndFeedInput input = new SyndFeedInput();
  25.         SyndFeed feed = input.build(new XmlReader(url));
  26.         log.info(feed.toString());
  27.         for (SyndEntry entry : (List<SyndEntry>) feed.getEntries()) {
  28.             log.info(entry.toString());
  29.             for (SyndLinkImpl link : (List<SyndLinkImpl>) entry.getLinks()) {
  30.                 log.info(link.toString());
  31.             }
  32.             for (SyndContentImpl content : (List<SyndContentImpl>) entry.getContents()) {
  33.                 log.info(content.toString());
  34.             }
  35.             for (SyndCategoryImpl category : (List<SyndCategoryImpl>) entry.getCategories()) {
  36.                 log.info(category.toString());
  37.             }
  38.         }
  39.     }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment