Android XML Node Value Get getDoubleNodeValue(Node node)

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

Description

get Double Node Value

Declaration

public static double getDoubleNodeValue(Node node) throws Exception 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    public static double getDoubleNodeValue(Node node) throws Exception {
        return Double.parseDouble(getTextNodeValue(node));
    }//from w ww .  j ava  2 s .co m

    public static String getTextNodeValue(Node node) throws Exception {
        Node child;
        if (node != null) {
            if (node.hasChildNodes()) {
                child = node.getFirstChild();
                while (child != null) {
                    if (child.getNodeType() == Node.TEXT_NODE) {
                        return child.getNodeValue();
                    }
                    child = child.getNextSibling();
                }
            }
        }
        return "";
    }
}

Related

  1. GetBooleanValue(Node item)
  2. GetInt32Value(Node item)
  3. GetStringValue(Node item)
  4. getElementValue(Node aElem)
  5. getElementValue(Node elem)
  6. getElementValue(Node elem)
  7. getNextElement(Node el)