diff options
Diffstat (limited to 'src/eu/siacs/conversations/xml/Element.java')
-rw-r--r-- | src/eu/siacs/conversations/xml/Element.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/xml/Element.java b/src/eu/siacs/conversations/xml/Element.java index 91d9ed6b..2f1d7ad8 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<Element> getChildren() { return this.children; } + public Element setChildren(List<Element> children) { + this.children = children; + return this; + } + public String getContent() { return content; } @@ -85,6 +100,10 @@ public class Element { } } + public Hashtable<String, String> getAttributes() { + return this.attributes; + } + public String toString() { StringBuilder elementOutput = new StringBuilder(); if ((content==null)&&(children.size() == 0)) { |