blob: a80b484124648b3a85de2d75bed22b9ea8bf9797 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package de.podfetcher.syndication.namespace.atom;
import de.podfetcher.syndication.namespace.Namespace;
import de.podfetcher.syndication.namespace.SyndElement;
import de.podfetcher.syndication.util.HtmlUnescaper;
/** Represents Atom Element which contains text (content, title, summary). */
public class AtomText extends SyndElement {
public static final String TYPE_TEXT = "text";
public static final String TYPE_HTML = "html";
public static final String TYPE_XHTML = "xhtml";
private String type;
private String content;
public AtomText(String name, Namespace namespace, String type) {
super(name, namespace);
this.type = type;
}
/** Processes the content according to the type and returns it. */
public String getProcessedContent() {
if (type.equals(TYPE_HTML)) {
return HtmlUnescaper.unescape(content);
} else if (type.equals(TYPE_XHTML)) {
return content;
} else { // Handle as text by default
return content;
}
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getType() {
return type;
}
}
|