Android examples for XML:XML Attribute
get Attribute As Boolean from XML Element
//package com.java2s; import org.w3c.dom.Element; public class Main { public static Boolean getAttribAsBoolean(Element e, String name) { return getAttribAsBoolean(e, name, false); }//from w w w . ja v a 2 s . co m public static Boolean getAttribAsBoolean(Element e, String name, Boolean dft) { if (getAttribute(e, name) == null) return dft; else return Boolean.parseBoolean(getAttribute(e, name)); } public static String getAttribute(Element e, String name) { if (e.getAttribute(name) == null) return ""; return e.getAttribute(name); } }