Android Utililty Methods XML Element Child Check

List of utility methods to do XML Element Child Check


The list of methods to do XML Element Child Check are organized into topic(s).


booleanhasChildElements(Element element)
Indicates whether element has any child element.
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
    Node node = childNodes.item(i);
    if (node.getNodeType() == Node.ELEMENT_NODE) {
        return true;
return false;
booleanhasChildren(Element e)
has Children
if (e == null)
    return false;
return e.getFirstChild() != null;