Java tutorial
//package com.java2s; import org.w3c.dom.Element; public class Main { public static boolean readBooleanAttribute(Element elem, String name, boolean defaultValue) { boolean back = defaultValue; String str = elem.getAttribute(name); if (str != null) { if (str.length() > 0) { int hash = str.hashCode(); if ((hash == "yes".hashCode()) || (hash == "true".hashCode())) { back = true; } else { back = false; } } } return back; } }