Java tutorial
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import org.w3c.dom.Element; public class Main { public static String getAttribute(Element elem, String name, String def) { return elem.hasAttribute(name) ? elem.getAttribute(name) : def; } }