Java XML NodeList getNodeValue(NodeList nodes)

Here you can find the source of getNodeValue(NodeList nodes)

Description

get Node Value

License

Open Source License

Declaration

public static String getNodeValue(NodeList nodes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.*;

public class Main {
    public static String getNodeValue(NodeList nodes) {
        Node node = nodes.item(0);
        String value = null;//from  w w w  .j  a v a2 s .  c o m
        if (nodes.getLength() > 0) {
            NodeList children = node.getChildNodes();
            int length = children.getLength();
            if (length == 1) {
                Node textNode = children.item(0);
                value = textNode.getNodeValue();
            }
        }
        return value;

    }
}

Related

  1. getNodeListLength(NodeList list)
  2. getNodes(String tagName, NodeList nodes)
  3. getNodesByName(String name, NodeList nodeList)
  4. getNodesOfType(NodeList list, short type)
  5. getNodeTrimValue(NodeList nodeList)
  6. getNodeValue(NodeList nodes, String tagName)
  7. getNodeValue(String tagName, NodeList nodes)
  8. getOccurs(String nodeName, NodeList nodes)
  9. getTableIDOfTableAlias(String tableAlias, NodeList referList1, NodeList referList2)