Android examples for XML:XML Node
Get Int Value from XML Node
//package com.java2s; import org.w3c.dom.*; public class Main { public static int GetInt32Value(Node item) throws Exception { String asString = GetStringValue(item); return Integer.parseInt(asString); }/*from w w w . j av a 2 s .c o m*/ public static String GetStringValue(Node item) throws Exception { 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'.", item.getClass())); } }