Java XML Node Value getNodeValue(Node node)

Here you can find the source of getNodeValue(Node node)

Description

Utility method to fetch the value of the element node

License

Open Source License

Parameter

Parameter Description
node a parameter

Declaration

public static String getNodeValue(Node node) 

Method Source Code


//package com.java2s;
import org.w3c.dom.*;

public class Main {
    /**/*w w  w.  ja v a 2s .co m*/
     * Utility method to fetch the value of the element node
     * @param node
     * @return
     */
    public static String getNodeValue(Node node) {
        for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
            if (child.getNodeType() == Node.TEXT_NODE) {
                return child.getNodeValue();
            }
        }
        return null;
    }
}

Related

  1. getNodeValue(Node node)
  2. getNodeValue(Node node)
  3. getNodeValue(Node node)
  4. getNodeValue(Node node)
  5. getNodeValue(Node node)
  6. getNodeValue(Node node)
  7. getNodeValue(Node node)
  8. getNodeValue(Node node)
  9. getNodeValue(Node node)