Android examples for XML:XML Attribute
get Attribute As Float from XML Element
//package com.java2s; import org.w3c.dom.Element; public class Main { public static Float getAttribAsFloat(Element e, String name, Float dft) { String num = getAttribute(e, name); return num.equals("") ? dft : Float.parseFloat(num); }/* w w w .j av a2s .c om*/ public static String getAttribute(Element e, String name) { if (e.getAttribute(name) == null) return ""; return e.getAttribute(name); } }