Android examples for XML:XML Element
Parse Int from XML Element text content
import java.util.UUID; import java.util.logging.Level; import org.w3c.dom.Element; public class Main{ public static int ParseInt(Element e) { int value = 0; try {/*www. jav a 2 s. c o m*/ value = Integer.parseInt(e.getTextContent().trim()); } catch (NumberFormatException ex) { Log.log("Preferences.loadXMLFile(): An Exception occured while parsing the integer '" + e.getNodeName() + "'. value=" + e.getTextContent().trim(), Level.INFO); } return value; } }