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 {
    /**Returns the first ELEMENT with name str, while ignoring whitespace nodes
     * 
     * @param elm 
     * @param str
     * @return the String value of a child node of Element elm that has a name str
     * or null if no match
     */
    public static Element getChildElementByName(Element elm, String str) {
        NodeList nList = elm.getElementsByTagName(str);
        return nList == null ? null : (Element) nList.item(0);
    }
}