Java XML Node Value getNodeValue(org.w3c.dom.Node node)

Here you can find the source of getNodeValue(org.w3c.dom.Node node)

Description

get Node Value

License

Open Source License

Declaration

public static String getNodeValue(org.w3c.dom.Node node) 

Method Source Code

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

import org.w3c.dom.Node;

public class Main {
    public static String getNodeValue(org.w3c.dom.Node node) {
        for (int i = 0; i < node.getChildNodes().getLength(); i++) {
            if (node.getChildNodes().item(i).getNodeType() == Node.TEXT_NODE)
                return node.getChildNodes().item(i).getNodeValue();
        }/*from  ww w  .  ja v a 2 s . c  o  m*/
        return "";
    }
}

Related

  1. getNodeValue(Node node, String name, boolean trim)
  2. getNodeValue(Node node, String name, String defaultVal, int index)
  3. getNodeValue(Node node, String nodeKey)
  4. getNodeValue(Node nodeXML)
  5. getNodeValue(org.w3c.dom.Node node)
  6. getNodeValueAsDate(Node node)
  7. getNodeValueAsLong(Node node)
  8. getNodeValueAsTime(Node node)
  9. getValue(Node node)