Here you can find the source of getAttribute(Element element, String name, String defaultVal)
public static String getAttribute(Element element, String name, String defaultVal)
//package com.java2s; // License as published by the Free Software Foundation; either import org.w3c.dom.Element; public class Main { public static String getAttribute(Element element, String name, String defaultVal) { if (element.hasAttribute(name)) { return element.getAttribute(name); } else {//from ww w. j a v a 2 s . c o m return defaultVal; } } }