Java tutorial
//package com.java2s; /* Copyright 2004 - 2007 Kasper Nielsen <kasper@codehaus.org> Licensed under * the Apache 2.0 License, see http://coconut.codehaus.org/license. */ import org.w3c.dom.Element; public class Main { public static boolean attributeBooleanGet(Element e, String name, boolean defaultValue) { if (!e.hasAttribute(name)) { return defaultValue; } else { return Boolean.parseBoolean(e.getAttribute(name)); } } }