Java SyndFeedInput 解析提要

Java SyndFeedInput parse feed

我想使用 SyndFeedInput 解析非标准提要

<entry>
<title>4 - Fleetmatics Group plc (0001526160) (Issuer)</title>
<link rel="alternate" type="text/html" href="http://www.sec.gov/Archives/edgar/data/1526160/000120919116115415/0001209191-16-115415-index.htm"/>
<summary type="html">
 &lt;b&gt;Filed:&lt;/b&gt; 2016-04-22 &lt;b&gt;AccNo:&lt;/b&gt; 0001209191-16-115415 &lt;b&gt;Size:&lt;/b&gt; 13 KB
</summary>
<updated>2016-04-22T21:07:34-04:00</updated>
<category scheme="http://www.sec.gov/" label="form type" term="4"/>
<id>urn:tag:sec.gov,2008:accession-number=0001209191-16-115415</id>
</entry>

我可以得到 titlelinkupdated。但是不知道如何得到 summaryterm in category.

while (itEntries.hasNext()) {
            SyndEntry entry = (SyndEntry) itEntries.next();
            String title = StringEscapeUtils.unescapeHtml3(entry.getTitle());
            String link = entry.getLink();
            Date datetime = entry.getUpdatedDate();
            //Module summary = entry.getModule("summary");
            System.out.println(title);
            System.out.println(link);
            System.out.println(datetime);

}

请指教!

您可以通过循环访问的类别 entry.getCategories() 和摘要映射到 entry.getDescription():

SyndFeed feed = ..
for (SyndEntry entry : feed.getEntries()) {
    for (SyndCategory category : entry.getCategories()) {
        System.out.println(category.getName()); // term
    }

    SyndContent summary = entry.getDescription();
    System.out.println(summary.getValue());
}