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.NodeList;

public class Main {
    public static Element getChildElement(String elementName, Element parentElement) {
        NodeList childList = parentElement.getElementsByTagName(elementName);
        if (childList == null || childList.getLength() == 0) {
            return null;
        }

        Element element = (Element) childList.item(0);
        return element;
    }
}