Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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;
        }
        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;
    }
}