1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 /***
32 */
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 }
47
48 protected SyndEntry createSyndEntry(Item item) {
49 SyndEntry syndEntry = super.createSyndEntry(item);
50
51 Description desc = item.getDescription();
52 if (desc!=null) {
53 SyndContent content = new SyndContentImpl();
54 content.setType(desc.getType());
55 content.setValue(desc.getValue());
56 syndEntry.setDescription(content);
57
58
59
60 List contents = new ArrayList();
61 contents.add(content);
62 syndEntry.setContents(contents);
63
64 }
65 return syndEntry;
66 }
67
68 protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
69 Channel channel = (Channel) super.createRealFeed(type,syndFeed);
70 return channel;
71 }
72
73 protected Item createRSSItem(SyndEntry sEntry) {
74 Item item = super.createRSSItem(sEntry);
75
76 SyndContent sContent = sEntry.getDescription();
77 if (sContent!=null) {
78 item.setDescription(createItemDescription(sContent));
79 }
80 return item;
81 }
82
83 protected Description createItemDescription(SyndContent sContent) {
84 Description desc = new Description();
85 desc.setValue(sContent.getValue());
86 desc.setType(sContent.getType());
87 return desc;
88 }
89
90 }