diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-05-14 14:42:21 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-05-20 03:48:14 +0200 |
commit | e32f380dae4913d8152fc92b76193de241089cf8 (patch) | |
tree | 788ee2f2a2c5f3eeff479d66b817f2ab059ca629 /src/main/java/eu/siacs/conversations/xml/Element.java | |
parent | 7824c01748a89688c5f76307cc1f4221a9e2ffb5 (diff) |
provide helper function for getting the content of a child directly
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xml/Element.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xml/Element.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/xml/Element.java b/src/main/java/eu/siacs/conversations/xml/Element.java index 51708759..32657c66 100644 --- a/src/main/java/eu/siacs/conversations/xml/Element.java +++ b/src/main/java/eu/siacs/conversations/xml/Element.java @@ -57,6 +57,11 @@ public class Element { return null; } + public String findChildContent(String name) { + Element element = findChild(name); + return element == null ? null : element.getContent(); + } + public Element findChild(String name, String xmlns) { for (Element child : this.children) { if (child.getName().equals(name) @@ -67,6 +72,11 @@ public class Element { return null; } + public String findChildContent(String name, String xmlns) { + Element element = findChild(name,xmlns); + return element == null ? null : element.getContent(); + } + public boolean hasChild(final String name) { return findChild(name) != null; } |