KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
23  */

24 public class RSS093Parser extends RSS092Parser {
25
26     public RSS093Parser() {
27         this("rss_0.93");
28     }
29
30     protected RSS093Parser(String JavaDoc type) {
31         super(type);
32     }
33
34     protected String JavaDoc getRSSVersion() {
35             return "0.93";
36     }
37
38     protected Item parseItem(Element rssRoot,Element eItem) {
39         Item item = super.parseItem(rssRoot,eItem);
40         Element e = eItem.getChild("pubDate",getRSSNamespace());
41         if (e!=null) {
42             item.setPubDate(DateParser.parseRFC822(e.getText()));
43         }
44         e = eItem.getChild("expirationDate",getRSSNamespace());
45         if (e!=null) {
46             item.setExpirationDate(DateParser.parseRFC822(e.getText()));
47         }
48         e = eItem.getChild("description",getRSSNamespace());
49         if (e!=null) {
50             String JavaDoc type = e.getAttributeValue("type");
51             if (type!=null) {
52                 item.getDescription().setType(type);
53             }
54         }
55         return item;
56     }
57
58 }
59
Popular Tags