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;

public class Main {
    public static Node getFirstGrandChild(Element parent, String child) {
        return (getChildNode(parent, child) != null) ? getChildNode(parent, child).getFirstChild() : null;
    }

    public static Node getChildNode(Element parent, String child) {
        return (parent.getElementsByTagName(child) != null) ? parent.getElementsByTagName(child).item(0) : null;
    }
}