aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/gultsch/chat/xml')
-rw-r--r--src/de/gultsch/chat/xml/Element.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/xml/Element.java b/src/de/gultsch/chat/xml/Element.java
index d6d1b23d..af3d8f1f 100644
--- a/src/de/gultsch/chat/xml/Element.java
+++ b/src/de/gultsch/chat/xml/Element.java
@@ -4,6 +4,8 @@ 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>();
@@ -26,6 +28,15 @@ public class Element {
return this;
}
+ public boolean hasChild(String name) {
+ for(Element child : this.children) {
+ if (child.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public Element setAttribute(String name, String value) {
this.attributes.put(name, value);
return this;
@@ -36,6 +47,14 @@ public class Element {
return this;
}
+ public String getAttribute(String name) {
+ if (this.attributes.containsKey(name)) {
+ return this.attributes.get(name);
+ } else {
+ return null;
+ }
+ }
+
public String toString() {
StringBuilder elementOutput = new StringBuilder();
if ((content==null)&&(children.size() == 0)) {