Android XML Node Value Get getElementValue(Node aElem)

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

Description

Gets item value

Parameter

Parameter Description
aElem Element

Return

Value

Declaration

public static final String getElementValue(Node aElem) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    /**//from   ww w . j av a  2  s .co m
     * Gets item value
     * 
     * @param aElem
     *            Element
     * @return Value
     */
    public static final String getElementValue(Node aElem) {
        Node child;
        if (aElem != null) {
            if (aElem.hasChildNodes()) {
                for (child = aElem.getFirstChild(); child != null; child = child
                        .getNextSibling()) {
                    if (child.getNodeType() == Node.TEXT_NODE) {
                        return child.getNodeValue();
                    }
                }
            }
        }
        return "";
    }
}

Related

  1. GetBooleanValue(Node item)
  2. GetInt32Value(Node item)
  3. GetStringValue(Node item)
  4. getDoubleNodeValue(Node node)
  5. getElementValue(Node elem)
  6. getElementValue(Node elem)
  7. getNextElement(Node el)
  8. getNodeValue(Node node)