From 4864f7200bbdb3e8d45eb7f165d62274f19e2e7b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 27 Mar 2014 02:02:59 +0100 Subject: fixed a couple of muc issues. added jingle listener (which doesn't do anything for now) --- src/eu/siacs/conversations/xml/Element.java | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/eu/siacs/conversations/xml') diff --git a/src/eu/siacs/conversations/xml/Element.java b/src/eu/siacs/conversations/xml/Element.java index 91d9ed6b4..2f1d7ad8c 100644 --- a/src/eu/siacs/conversations/xml/Element.java +++ b/src/eu/siacs/conversations/xml/Element.java @@ -50,19 +50,34 @@ public class Element { return null; } - public boolean hasChild(String name) { + public Element findChild(String name, String xmlns) { for(Element child : this.children) { - if (child.getName().equals(name)) { - return true; + if (child.getName().equals(name)&&(child.getAttribute("xmlns").equals(xmlns))) { + return child; } } - return false; + return null; + } + + public boolean hasChild(String name) { + return findChild(name) != null; + } + + public boolean hasChild(String name, String xmlns) { + return findChild(name, xmlns) != null; } + + public List getChildren() { return this.children; } + public Element setChildren(List children) { + this.children = children; + return this; + } + public String getContent() { return content; } @@ -85,6 +100,10 @@ public class Element { } } + public Hashtable getAttributes() { + return this.attributes; + } + public String toString() { StringBuilder elementOutput = new StringBuilder(); if ((content==null)&&(children.size() == 0)) { -- cgit v1.2.3