summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-01-24 17:05:31 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-01-24 18:23:06 (GMT)
commit12740e2b70c48e478af53de31624c388e1e89e0f (patch)
tree2ca29487cfcb094cd594cb60363a267a632f024b /src/com
parent54587c45febd330e2b8e117fe0815569bd37e366 (diff)
downloadstroke-12740e2b70c48e478af53de31624c388e1e89e0f.zip
stroke-12740e2b70c48e478af53de31624c388e1e89e0f.tar.bz2
Fix XML serialisation.
Also port the unit tests from Swiften.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/isode/stroke/serializer/xml/XMLElement.java10
-rw-r--r--src/com/isode/stroke/serializer/xml/XMLTextNode.java8
2 files changed, 9 insertions, 9 deletions
diff --git a/src/com/isode/stroke/serializer/xml/XMLElement.java b/src/com/isode/stroke/serializer/xml/XMLElement.java
index 43abfea..9512c85 100644
--- a/src/com/isode/stroke/serializer/xml/XMLElement.java
+++ b/src/com/isode/stroke/serializer/xml/XMLElement.java
@@ -57,11 +57,11 @@ public class XMLElement implements XMLNode {
public void setAttribute(String attribute, String value) {
String escapedValue = value;
- escapedValue.replaceAll("&", "&amp;");
- escapedValue.replaceAll("<", "&lt;");
- escapedValue.replaceAll(">", "&gt;");
- escapedValue.replaceAll("'", "&apos;");
- escapedValue.replaceAll("\"", "&quot;");
+ escapedValue = escapedValue.replaceAll("&", "&amp;");
+ escapedValue = escapedValue.replaceAll("<", "&lt;");
+ escapedValue = escapedValue.replaceAll(">", "&gt;");
+ escapedValue = escapedValue.replaceAll("'", "&apos;");
+ escapedValue = escapedValue.replaceAll("\"", "&quot;");
attributes_.put(attribute, escapedValue);
}
diff --git a/src/com/isode/stroke/serializer/xml/XMLTextNode.java b/src/com/isode/stroke/serializer/xml/XMLTextNode.java
index b6940c4..fa1881e 100644
--- a/src/com/isode/stroke/serializer/xml/XMLTextNode.java
+++ b/src/com/isode/stroke/serializer/xml/XMLTextNode.java
@@ -10,13 +10,13 @@ package com.isode.stroke.serializer.xml;
public class XMLTextNode implements XMLNode {
- private final String text_;
+ private String text_;
public XMLTextNode(String text) {
text_ = text;
- text_.replaceAll("&", "&amp;"); // Should come first
- text_.replaceAll("<", "&lt;");
- text_.replaceAll(">", "&gt;");
+ text_ = text_.replaceAll("&", "&amp;"); // Should come first
+ text_ = text_.replaceAll("<", "&lt;");
+ text_ = text_.replaceAll(">", "&gt;");
}
public String serialize() {