Java tutorial
//package com.java2s; import org.w3c.dom.Element; public class Main { public static synchronized String gerAttribute(Element e, String name) { return getAttribute(e, name, null); } public static synchronized String getAttribute(Element e, String name, String defvalue) { if (e == null || name == null || name.length() == 0) { return defvalue; } else { return e.getAttribute(name); } } }