解析feed java

时间:2014-03-27 16:26:54

标签: java xml

我正在使用rome.jar用java解析Wordpress feed:

public class RSSReader {

  public static void main(String[] args) throws Exception {

    URL url  = new URL("http://ayudawp.com/feed/");
    XmlReader reader = null;

    try {

      reader = new XmlReader(url);
      SyndFeed feed = new SyndFeedInput().build(reader);


     for (Iterator i = feed.getEntries().iterator(); i.hasNext();) {
        SyndEntry entry = (SyndEntry) i.next();
        System.out.println(entry.getTitle());
        System.out.println(entry.getDescription());
        System.out.println(entry.getContents());
        System.out.println(entry.getPublishedDate());
            }
        } finally {
            if (reader != null)
                reader.close();
        }
    }
}

但是当我执行entry.getContent()的System.out.println时,我看不到新内容的所有内容。有解决方案吗?我的Feed代码有格式

1 个答案:

答案 0 :(得分:0)