diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-01 01:25:56 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-01 01:25:56 +0100 |
commit | 43531113b798cda6b2f76257641f38b0af986437 (patch) | |
tree | 73107f086ec5d772a9041aa3ad4b1c7b8e0dcce9 /src/de/gultsch/chat/xml | |
parent | c3e4f0eaacf8ab32ceab32b8f46e8b7d85c71cfb (diff) |
more code cleanup for xmpp parser. more eventy. nice unknown contact pictures
Diffstat (limited to '')
-rw-r--r-- | src/de/gultsch/chat/xml/Element.java | 19 |
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)) { |