1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.io.impl;
18
19 import com.sun.syndication.feed.rss.Description;
20 import org.jdom.Attribute;
21 import org.jdom.Document;
22 import org.jdom.Element;
23
24 /***
25 */
26 public class RSS20Parser extends RSS094Parser {
27
28 public RSS20Parser() {
29 this("rss_2.0");
30 }
31
32 protected RSS20Parser(String type) {
33 super(type);
34 }
35
36 protected String getRSSVersion() {
37 return "2.0";
38 }
39
40 protected boolean isHourFormat24(Element rssRoot) {
41 return false;
42 }
43
44 protected Description parseItemDescription(Element rssRoot,Element eDesc) {
45 Description desc = super.parseItemDescription(rssRoot,eDesc);
46 desc.setType("text/html");
47 return desc;
48 }
49
50 public boolean isMyType(Document document) {
51 boolean ok;
52 Element rssRoot = document.getRootElement();
53 ok = rssRoot.getName().equals("rss");
54 if (ok) {
55 ok = false;
56 Attribute version = rssRoot.getAttribute("version");
57 if (version!=null) {
58
59
60 ok = version.getValue().startsWith(getRSSVersion());
61 }
62 }
63 return ok;
64 }
65
66 }