1 17 package com.sun.syndication.feed.synd.impl; 18 19 import com.sun.syndication.feed.WireFeed; 20 import com.sun.syndication.feed.rss.Channel; 21 import com.sun.syndication.feed.rss.Description; 22 import com.sun.syndication.feed.rss.Item; 23 import com.sun.syndication.feed.synd.SyndContent; 24 import com.sun.syndication.feed.synd.SyndContentImpl; 25 import com.sun.syndication.feed.synd.SyndEntry; 26 import com.sun.syndication.feed.synd.SyndFeed; 27 28 import java.util.ArrayList ; 29 import java.util.List ; 30 31 33 public class ConverterForRSS10 extends ConverterForRSS090 { 34 35 public ConverterForRSS10() { 36 this("rss_1.0"); 37 } 38 39 protected ConverterForRSS10(String type) { 40 super(type); 41 } 42 43 public void copyInto(WireFeed feed,SyndFeed syndFeed) { 44 Channel channel = (Channel) feed; 45 super.copyInto(channel,syndFeed); 46 syndFeed.setUri(channel.getUri()); 47 } 48 49 protected SyndEntry createSyndEntry(Item item) { 50 SyndEntry syndEntry = super.createSyndEntry(item); 51 52 Description desc = item.getDescription(); 53 if (desc!=null) { 54 SyndContent content = new SyndContentImpl(); 55 content.setType(desc.getType()); 56 content.setValue(desc.getValue()); 57 syndEntry.setDescription(content); 58 59 List contents = new ArrayList (); 62 contents.add(content); 63 syndEntry.setContents(contents); 64 65 } 66 return syndEntry; 67 } 68 69 protected WireFeed createRealFeed(String type,SyndFeed syndFeed) { 70 Channel channel = (Channel) super.createRealFeed(type,syndFeed); 71 channel.setUri(syndFeed.getUri()); 72 return channel; 73 } 74 75 protected Item createRSSItem(SyndEntry sEntry) { 76 Item item = super.createRSSItem(sEntry); 77 78 SyndContent sContent = sEntry.getDescription(); 79 if (sContent!=null) { 80 item.setDescription(createItemDescription(sContent)); 81 } 82 return item; 83 } 84 85 protected Description createItemDescription(SyndContent sContent) { 86 Description desc = new Description(); 87 desc.setValue(sContent.getValue()); 88 desc.setType(sContent.getType()); 89 return desc; 90 } 91 92 } 93 | Popular Tags |