KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > syndication > io > impl > RSS093Generator


1 /*
2  * Copyright 2004 Sun Microsystems, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package com.sun.syndication.io.impl;
18
19 import com.sun.syndication.feed.rss.Item;
20 import org.jdom.Element;
21
22 import java.util.Date JavaDoc;
23 import java.util.List JavaDoc;
24
25
26 /**
27  * Feed Generator for RSS 0.93
28  * <p/>
29  *
30  * @author Elaine Chien
31  *
32  */

33 public class RSS093Generator extends RSS092Generator {
34
35     public RSS093Generator() {
36         this("rss_0.93","0.93");
37     }
38
39     protected RSS093Generator(String JavaDoc feedType,String JavaDoc version) {
40         super(feedType,version);
41     }
42
43     protected void populateItem(Item item, Element eItem, int index) {
44         super.populateItem(item,eItem, index);
45
46         Date JavaDoc pubDate = item.getPubDate();
47         if (pubDate != null) {
48             eItem.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate)));
49         }
50
51         Date JavaDoc expirationDate = item.getExpirationDate();
52         if (expirationDate != null) {
53             eItem.addContent(generateSimpleElement("expirationDate", DateParser.formatRFC822(expirationDate)));
54         }
55     }
56
57     // Another one to thanks DW for
58
protected int getNumberOfEnclosures(List JavaDoc enclosures) {
59         return enclosures.size();
60     }
61
62 }
63
Popular Tags