Java XML Node Value Check isSubTagExist(Node node, String tagName)

Here you can find the source of isSubTagExist(Node node, String tagName)

Description

is Sub Tag Exist

License

Open Source License

Declaration

public static boolean isSubTagExist(Node node, String tagName) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static boolean isSubTagExist(Node node, String tagName) {
        if (node == null) {
            return false;
        }//from ww  w.  j  av  a2s.c o  m
        NodeList nodeList = node.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node n = nodeList.item(i);
            if (n instanceof Element) {
                if (((Element) n).getTagName().equals(tagName)) {
                    return true;
                }
            }
        }
        return false;
    }
}

Related

  1. isNodeTypeElement(Node node)
  2. isNullOrEmpty(Node node)
  3. isOrphanNode(Node node)
  4. isReturnTag(Node node)
  5. isSimpleValueProperty(Node node)
  6. isSuppressJoinFailure(Node node)
  7. isSynchronousInvoke(Node invoke)
  8. isText(final Node n)
  9. isText(Node node)