Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    /**
     * Gets the first child element of an element
     *
     * @param element the parent
     * @return the first child element or null if there isn't one
     */
    public static Element getFirstChildElement(Element element) {
        Node child = element.getFirstChild();
        while (child != null && child.getNodeType() != Node.ELEMENT_NODE)
            child = child.getNextSibling();

        return (Element) child;
    }
}