mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
retrive description for rss0.9 items (fixes #39)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.commafeed.backend.rome;
|
||||
|
||||
import com.sun.syndication.feed.rss.Description;
|
||||
import com.sun.syndication.feed.rss.Item;
|
||||
import com.sun.syndication.feed.synd.SyndContentImpl;
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.impl.ConverterForRSS090;
|
||||
|
||||
public class RSS090DescriptionConverter extends ConverterForRSS090 {
|
||||
|
||||
@Override
|
||||
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
|
||||
SyndEntry entry = super.createSyndEntry(item, preserveWireItem);
|
||||
Description desc = item.getDescription();
|
||||
if (desc != null) {
|
||||
SyndContentImpl syndDesc = new SyndContentImpl();
|
||||
syndDesc.setValue(desc.getValue());
|
||||
entry.setDescription(syndDesc);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.commafeed.backend.rome;
|
||||
|
||||
import org.jdom.Element;
|
||||
|
||||
import com.sun.syndication.feed.rss.Description;
|
||||
import com.sun.syndication.feed.rss.Item;
|
||||
import com.sun.syndication.io.impl.RSS090Parser;
|
||||
|
||||
public class RSS090DescriptionParser extends RSS090Parser {
|
||||
|
||||
@Override
|
||||
protected Item parseItem(Element rssRoot, Element eItem) {
|
||||
Item item = super.parseItem(rssRoot, eItem);
|
||||
|
||||
Element e = eItem.getChild("description", getRSSNamespace());
|
||||
if (e != null) {
|
||||
Description desc = new Description();
|
||||
desc.setValue(e.getText());
|
||||
item.setDescription(desc);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user