aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xml/Element.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/xml/Element.java')
-rw-r--r--src/eu/siacs/conversations/xml/Element.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/xml/Element.java b/src/eu/siacs/conversations/xml/Element.java
index ad95ef9c..6cf6d3a5 100644
--- a/src/eu/siacs/conversations/xml/Element.java
+++ b/src/eu/siacs/conversations/xml/Element.java
@@ -4,8 +4,6 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import android.util.Log;
-
public class Element {
protected String name;
protected Hashtable<String, String> attributes = new Hashtable<String, String>();
@@ -83,7 +81,7 @@ public class Element {
startTag.setAtttributes(this.attributes);
elementOutput.append(startTag);
if (content!=null) {
- elementOutput.append(content);
+ elementOutput.append(encodeEntities(content));
} else {
for(Element child : children) {
elementOutput.append(child.toString());
@@ -98,4 +96,13 @@ public class Element {
public String getName() {
return name;
}
+
+ private String encodeEntities(String content) {
+ content = content.replace("&","&amp;");
+ content = content.replace("<","&lt;");
+ content = content.replace(">","&gt;");
+ content = content.replace("\"","&quot;");
+ content = content.replace("'","&apos;");
+ return content;
+ }
}