Android XML Node Value Get getElementValue(Node elem)

Here you can find the source of getElementValue(Node elem)

Description

get Element Value

Declaration

public static String getElementValue(Node elem) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    public static String getElementValue(Node elem) {
        Node child;// w  w  w  .j  av a 2  s .co  m
        if (elem != null) {
            if (elem.hasChildNodes()) {
                for (child = elem.getFirstChild(); child != null; child = child
                        .getNextSibling()) {
                    if (child.getNodeType() == Node.TEXT_NODE) {
                        return child.getNodeValue();
                    }
                }
            }
        }
        return "";
    }
}

Related

  1. GetInt32Value(Node item)
  2. GetStringValue(Node item)
  3. getDoubleNodeValue(Node node)
  4. getElementValue(Node aElem)
  5. getElementValue(Node elem)
  6. getNextElement(Node el)
  7. getNodeValue(Node node)
  8. getText(Node n)
  9. getText(Node node, String tag)