Here you can find the source of getAttr(final Node n, final String attr)
public static String getAttr(final Node n, final String attr)
//package com.java2s; // Licensed under the MIT license. See License.txt in the repository root. import org.w3c.dom.Node; public class Main { public static String getAttr(final Node n, final String attr) { final Node attrNode = n.getAttributes().getNamedItem(attr); if (attrNode != null) { return attrNode.getNodeValue(); }//from ww w . j a va 2 s.c o m return null; } }