Here you can find the source of getAttr(Node node, String name, String defaultValue)
public static String getAttr(Node node, String name, String defaultValue)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { public static String getAttr(Node node, String name, String defaultValue) { String result = defaultValue; if (node != null && node.getAttributes() != null && node.getAttributes().getNamedItem(name) != null) result = node.getAttributes().getNamedItem(name).getNodeValue(); return result; }/*from w ww.j a va 2s .c o m*/ }