Java tutorial
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; public class Main { public static boolean getElementBooleanValue(Element element, String attribute) { return getElementBooleanValue(element, attribute, false); } public static boolean getElementBooleanValue(Element element, String attribute, boolean defaultValue) { if (!element.hasAttribute(attribute)) return defaultValue; return Boolean.valueOf(getElementStringValue(element, attribute)).booleanValue(); } public static String getElementStringValue(Element element, String attribute) { return element.getAttribute(attribute); } }