Android XML Element Value Get getIntegerValue(String tag, Element element)

Here you can find the source of getIntegerValue(String tag, Element element)

Description

get Integer Value

Declaration

public static Integer getIntegerValue(String tag, Element element) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static Integer getIntegerValue(String tag, Element element) {
        return Integer.parseInt(getStringValue(tag, element), 10);
    }//from  w  w w  .ja  va  2 s.  c o m

    public static String getStringValue(String tag, Element element) {
        NodeList nodes = element.getElementsByTagName(tag).item(0)
                .getChildNodes();
        Node node = (Node) nodes.item(0);
        return node.getNodeValue();
    }
}

Related

  1. getValue(Element item, String str)
  2. getStringValue(String tag, Element element)
  3. getCData(Element element)
  4. getContent(Element xmlElement)
  5. getElementText(Element element)