Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// License as published by the Free Software Foundation; either

import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    /**
     * Get the indexed Element.
     * <p>
     * Similar to <code>Element.getChildNodes.item</code>, but ignores any Nodes (such as
     * indentation TextNodes).
     */

    public static Element getFirstChildElement(Element parent) {

        Node node = parent.getFirstChild();

        while (node != null && !(node instanceof Element)) {

            node = node.getNextSibling();
        }

        return (Element) node;
    }
}