summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java
blob: 16beb277b67d6d526549512a41d93ccac6f52104 (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
47
package de.danoeh.antennapod.syndication.namespace.atom;

import org.apache.commons.lang3.StringEscapeUtils;

import de.danoeh.antennapod.syndication.namespace.Namespace;
import de.danoeh.antennapod.syndication.namespace.SyndElement;

/** 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 StringEscapeUtils.unescapeHtml4(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;
	}
	
	

}