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.NodeList;

public class Main {
    /**
     * Gets the first text value of a NodeList
     * @param nList NodeList
     * @return first text value of a NodeList
     */
    public static String getFirstTextValueFromNodeList(NodeList nList) {
        if (nList != null && nList.getLength() != 0) {
            return nList.item(0).getTextContent();
        }
        return null;
    }
}