diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xml/Element.java | 11 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xml/Tag.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xml/XmlElementContainer.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xml/XmlHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/XmlHelper.java) | 0 |
4 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/Element.java b/src/main/java/de/thedevstack/conversationsplus/xml/Element.java index 429f98db..23836365 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xml/Element.java +++ b/src/main/java/de/thedevstack/conversationsplus/xml/Element.java @@ -6,7 +6,6 @@ import java.util.List; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.utils.XmlHelper; import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; import de.thedevstack.conversationsplus.xmpp.jid.Jid; @@ -75,6 +74,11 @@ public class Element { return null; } + public Element findChild(XmlElementContainer container) { + Element element = container.getXmlElement(); + return findChild(element.getName(), element.getNamespace()); + } + public String findChildContent(String name, String xmlns) { Element element = findChild(name,xmlns); return element == null ? null : element.getContent(); @@ -88,6 +92,11 @@ public class Element { return findChild(name, xmlns) != null; } + public boolean hasChild(XmlElementContainer container) { + Element element = container.getXmlElement(); + return hasChild(element.getName(), element.getNamespace()); + } + public List<Element> getChildren() { return this.children; } diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/Tag.java b/src/main/java/de/thedevstack/conversationsplus/xml/Tag.java index 84e37363..7072b56f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xml/Tag.java +++ b/src/main/java/de/thedevstack/conversationsplus/xml/Tag.java @@ -5,8 +5,6 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; -import de.thedevstack.conversationsplus.utils.XmlHelper; - public class Tag { public static final int NO = -1; public static final int START = 0; diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/XmlElementContainer.java b/src/main/java/de/thedevstack/conversationsplus/xml/XmlElementContainer.java new file mode 100644 index 00000000..543e032d --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/xml/XmlElementContainer.java @@ -0,0 +1,7 @@ +package de.thedevstack.conversationsplus.xml; + +/** + */ +public interface XmlElementContainer { + Element getXmlElement(); +} diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/XmlHelper.java b/src/main/java/de/thedevstack/conversationsplus/xml/XmlHelper.java index 1287f73f..1287f73f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/XmlHelper.java +++ b/src/main/java/de/thedevstack/conversationsplus/xml/XmlHelper.java |