Java XML NodeList getFirstTextValueFromNodeList(NodeList nList)

Here you can find the source of getFirstTextValueFromNodeList(NodeList nList)

Description

Gets the first text value of a NodeList

License

Apache License

Parameter

Parameter Description
nList NodeList

Return

first text value of a NodeList

Declaration

public static String getFirstTextValueFromNodeList(NodeList nList) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.NodeList;

public class Main {
    /**//from w  w  w .  j av  a 2s.c o  m
     * 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;
    }
}

Related

  1. getFirstElement(NodeList list)
  2. getFirstElement(NodeList nodes)
  3. GetFirstInstance(NodeList nList)
  4. getFirstNode(NodeList nodeList)
  5. getFirstNodeValue(NodeList nodeList)
  6. getFirstValue(NodeList nodes)
  7. getMetaScriptType(List metaNodeList)
  8. getMethodNames(NodeList methodNodes)
  9. getNode(NodeList nodes, String tagName)