Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    /**
     * Returns true if element node has children elements
     * @param actElement
     * @return
     */
    protected static boolean hasChildElementNodes(Element actElement) {
        try {
            if (actElement.hasChildNodes()) {
                NodeList childNodes = actElement.getChildNodes();

                for (int i = 0; i < childNodes.getLength(); i++) {
                    Node element = childNodes.item(i);
                    if (element.getNodeType() == Node.ELEMENT_NODE) {
                        return true;
                    }
                }
            }
            return false;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
}