[英]Cannot get RSS feed content with Rome
I'm trying to read the content of an RSS feed using Rome 1.7.4. 我正在尝试使用Rome 1.7.4阅读RSS feed的内容。 Here's my code: 这是我的代码:
public static void main(String[] args) {
try{
URL feedURL = new URL("http://feeds.feedburner.com/consumeraffairs/SXJd");
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedURL));
System.out.println("Feed Title: " + feed.getTitle());
for (SyndEntry entry : feed.getEntries()){
System.out.println("Entry Title: " + entry.getTitle());
System.out.println("URL: " + entry.getUri());
for (SyndContent content : entry.getContents()){
System.out.println("Content: " + content.getValue());
}
}
} catch (Exception ex) {
ex.printStackTrace(System.out);
}
}
I'm trying to get the content of the feed, but it never enters the for content loop. 我正在尝试获取提要的内容,但是它从未进入for content循环。 Inspection of the variables says that content = null. 检查变量表示content = null。 What am I doing wrong? 我究竟做错了什么?
There are no content tags used in your feed. Feed中没有使用内容标签。 Try entry.getDescription().getValue()
to get feed's text content. 尝试entry.getDescription().getValue()
来获取供稿的文本内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.