diff options
Diffstat (limited to 'src/eu/siacs/conversations/xml/Element.java')
-rw-r--r-- | src/eu/siacs/conversations/xml/Element.java | 13 |
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("&","&"); + content = content.replace("<","<"); + content = content.replace(">",">"); + content = content.replace("\"","""); + content = content.replace("'","'"); + return content; + } } |