Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    /**
     * Return the child element whose name is as specified. 
     * <p>
     * Note: it's up to the user to guarantee that there EXISTS and is only 
     * ONE child element.
     * @param parent
     * @param name
     * @return
     */
    public static Element getUniqueElementByTagName(Element parent, String name) {
        Element elm = (Element) parent.getElementsByTagName(name).item(0);
        return elm;
    }
}