RSS读取内容

package com.rss.test;

import java.net.URL;
import java.util.List;


import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class RssNewsRead {
public static void main(String[] args){
boolean flag=false;
if(args.length==0){
try {
URL feedUrl=new URL("http://seu.org.cn/bbs/rss.php");
SyndFeedInput input=new SyndFeedInput();
SyndFeed feed=input.build(new XmlReader(feedUrl));
System.out.println(feed.getTitle());

//System.out.println(feed);
List list=feed.getEntries();
for(int i=0;i<list.size();i++){
SyndEntryImpl imp=(SyndEntryImpl) list.get(0);
System.out.println(imp.getTitle());
System.out.println(imp.getDescription().getValue());


}
flag=true;
} catch (Exception e) {
e.printStackTrace();
}
}


}
}

你可能感兴趣的:(PHP,.net,sun,bbs)