Java XML Has Child hasChild(Element parent, String nodeName)

Here you can find the source of hasChild(Element parent, String nodeName)

Description

has Child

License

Open Source License

Declaration

public static boolean hasChild(Element parent, String nodeName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static boolean hasChild(Element parent, String nodeName) {
        NodeList childNodes = parent.getChildNodes();
        int length = childNodes.getLength();
        for (int i = 0; i < length; i++)
            if (childNodes.item(i).getNodeName().equals(nodeName))
                return true;
        return false;
    }/*ww w .j  a  va 2  s. c o  m*/
}

Related

  1. getLastVisibleChildElement(Node parent, Hashtable hiddenNodes)
  2. hasActivityChildNode(Node node)
  3. hasAnyChildElement(final Element e)
  4. hasChild(Element element, String child)
  5. hasChild(Element node, String name)
  6. hasChild(Element root, String childName)
  7. hasChild(Element start, String name)
  8. hasChild(Node n)
  9. hasChildElement(Element elem, String namespace, String localName)