diff options
Diffstat (limited to 'src/eu/siacs/conversations/xml/Element.java')
-rw-r--r-- | src/eu/siacs/conversations/xml/Element.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/eu/siacs/conversations/xml/Element.java b/src/eu/siacs/conversations/xml/Element.java index d23a81ba..4e11ee2c 100644 --- a/src/eu/siacs/conversations/xml/Element.java +++ b/src/eu/siacs/conversations/xml/Element.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.List; +import eu.siacs.conversations.utils.XmlHelper; + public class Element { protected String name; protected Hashtable<String, String> attributes = new Hashtable<String, String>(); @@ -116,7 +118,7 @@ public class Element { startTag.setAtttributes(this.attributes); elementOutput.append(startTag); if (content != null) { - elementOutput.append(encodeEntities(content)); + elementOutput.append(XmlHelper.encodeEntities(content)); } else { for (Element child : children) { elementOutput.append(child.toString()); @@ -132,24 +134,15 @@ public class Element { return name; } - private String encodeEntities(String content) { - content = content.replace("&", "&"); - content = content.replace("<", "<"); - content = content.replace(">", ">"); - content = content.replace("\"", """); - content = content.replace("'", "'"); - return content; - } - public void clearChildren() { this.children.clear(); } public void setAttribute(String name, long value) { - this.setAttribute(name, "" + value); + this.setAttribute(name, Long.toString(value)); } public void setAttribute(String name, int value) { - this.setAttribute(name, "" + value); + this.setAttribute(name, Integer.toString(value)); } } |