Java XML Has Child hasChildOfType(final Element e, final String name)

Here you can find the source of hasChildOfType(final Element e, final String name)

Description

has Child Of Type

License

Open Source License

Declaration

public static boolean hasChildOfType(final Element e, final String name) 

Method Source Code

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

import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    public static boolean hasChildOfType(final Element e, final String name) {
        for (Node child = e.getFirstChild(); child != null; child = child
                .getNextSibling()) {//www. j  av  a  2  s  .  com
            if (child instanceof Element) {
                if (((Element) child).getTagName().equals(name)) {
                    return true;
                }
            }
        }
        return false;
    }
}

Related

  1. hasChildNode(Element root, String childNodeName)
  2. hasChildNode(Node parentNode, String nodeName)
  3. hasChildNodeByName(Node element, CharSequence nodeName, boolean caseSensitive)
  4. hasChildNodes(Element element, String name)
  5. hasChildNS(Node parent, String ns, String name)
  6. hasChildren(Element e)
  7. hasChildren(Element element)
  8. hasChildren(Element element)
  9. hasChildren(Element element, String childName)