introduces XmlContainerElement to ease searching for child elements and moves XmlHelper to xml package because it is only needed for xml handling
This commit is contained in:
parent
4ea955d8fe
commit
d222611abb
4 changed files with 17 additions and 3 deletions
src/main/java/de/thedevstack/conversationsplus/xml
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package de.thedevstack.conversationsplus.xml;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface XmlElementContainer {
|
||||
Element getXmlElement();
|
||||
}
|
Loading…
Add table
Reference in a new issue