Android Utililty Methods XML Node Value Get

List of utility methods to do XML Node Value Get

Description

The list of methods to do XML Node Value Get are organized into topic(s).

Method

booleanGetBooleanValue(Node item)
Get Boolean Value
String asString = GetStringValue(item);
if (asString.compareTo("0") == 0
        || asString.compareToIgnoreCase("false") == 0)
    return false;
else if (asString.compareTo("1") == 0
        || asString.compareToIgnoreCase("true") == 0)
    return true;
else
...
intGetInt32Value(Node item)
Get Int Value
String asString = GetStringValue(item);
return Integer.parseInt(asString);
StringGetStringValue(Node item)
Get String Value
if (item instanceof Element) {
    Node node = item.getFirstChild();
    if (node != null)
        return node.getNodeValue();
    else
        return "";
} else
    throw new Exception(String.format("Cannot handle '%s'.",
...
doublegetDoubleNodeValue(Node node)
get Double Node Value
return Double.parseDouble(getTextNodeValue(node));
StringgetElementValue(Node aElem)
Gets item value
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 "";
StringgetElementValue(Node elem)
get Element Value
Node kid;
if (elem != null) {
    if (elem.hasChildNodes()) {
        for (kid = elem.getFirstChild(); kid != null; kid = kid
                .getNextSibling()) {
            if (kid.getNodeType() == Node.TEXT_NODE) {
                return kid.getNodeValue();
return "";
StringgetElementValue(Node elem)
get Element Value
Node child;
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 "";
ElementgetNextElement(Node el)
get Next Element
while ((el != null) && (el.getNodeType() != Node.ELEMENT_NODE)) {
    el = el.getNextSibling();
return (Element) el;
StringgetNodeValue(Node node)
get Node Value
return (node == null || node.getFirstChild() == null || node
        .getFirstChild().getNodeValue() == null) ? null : node
        .getFirstChild().getNodeValue().trim();
StringgetText(Node n)
get Text
if (n != null) {
    Node text = n.getFirstChild();
    if (text != null) {
        String s = text.getNodeValue();
        return s.trim();
return "";
...