summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMili Verma <mili.verma@isode.com>2012-01-06 15:00:55 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-01-09 15:54:52 (GMT)
commitcc760bfd15caadb56bfef477cb54dc94c25f7fa7 (patch)
tree05f5918b97488b05ca1266c0644a3874adb98129 /src/com/isode/stroke/serializer/xml
parent12b1d667965556002ea0fd300a71bcdf57634e90 (diff)
downloadstroke-cc760bfd15caadb56bfef477cb54dc94c25f7fa7.zip
stroke-cc760bfd15caadb56bfef477cb54dc94c25f7fa7.tar.bz2
Port Adhoc commands to Stroke
This patch ports the Adhoc commands from Swiften to Stroke. It also ports their unit tests. Test-information: Unit tests pass. MLC able to use the ad-hoc command fine.
Diffstat (limited to 'src/com/isode/stroke/serializer/xml')
-rw-r--r--src/com/isode/stroke/serializer/xml/XMLElement.java7
-rw-r--r--src/com/isode/stroke/serializer/xml/XMLTextNode.java13
2 files changed, 16 insertions, 4 deletions
diff --git a/src/com/isode/stroke/serializer/xml/XMLElement.java b/src/com/isode/stroke/serializer/xml/XMLElement.java
index b464242..43abfea 100644
--- a/src/com/isode/stroke/serializer/xml/XMLElement.java
+++ b/src/com/isode/stroke/serializer/xml/XMLElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Isode Limited, London, England.
+ * Copyright (c) 2010-2012, Isode Limited, London, England.
* All rights reserved.
*/
/*
@@ -8,13 +8,14 @@
*/
package com.isode.stroke.serializer.xml;
-import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
import java.util.Vector;
public class XMLElement implements XMLNode {
private final String tag_;
- private final HashMap<String, String> attributes_ = new HashMap<String, String>();
+ private final Map<String, String> attributes_ = new TreeMap<String, String>();
private final Vector<XMLNode> childNodes_ = new Vector<XMLNode>();
public XMLElement(String tag) {
diff --git a/src/com/isode/stroke/serializer/xml/XMLTextNode.java b/src/com/isode/stroke/serializer/xml/XMLTextNode.java
index ae5cd32..22a6785 100644
--- a/src/com/isode/stroke/serializer/xml/XMLTextNode.java
+++ b/src/com/isode/stroke/serializer/xml/XMLTextNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Isode Limited, London, England.
+ * Copyright (c) 2010-2012, Isode Limited, London, England.
* All rights reserved.
*/
/*
@@ -22,4 +22,15 @@ public class XMLTextNode implements XMLNode {
public String serialize() {
return text_;
}
+
+ /**
+ * Create new object.
+ *
+ * @param text Text to create object with, must not be null
+ *
+ * @return new object, will never be null
+ */
+ public static XMLTextNode create(String text) {
+ return new XMLTextNode(text);
+ }
}