62,615
社区成员
发帖
与我相关
我的任务
分享
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
import java.net.*;
public class Writer {
public Writer(){
System.out.println("Start...");
String str ="http://wyzwz527.blogbus.com/index.rdf";
boolean ok = false;
try {
URL feedUrl = new URL(str);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedUrl));
System.out.println(feed);
ok = true;
}
catch (Exception ex) {
ex.printStackTrace();
System.out.println("ERROR: "+ex.getMessage());
}
if (!ok) {
System.out.println();
System.out.println("FeedReader reads and prints any RSS/Atom feed type.");
System.out.println("The first parameter must be the URL of the feed to read.");
System.out.println();
}
}
public static void main(String[] args){
new Writer();
}
}