Here you can find the source of getNodeAttr(String attrName, Node node)
public static String getNodeAttr(String attrName, Node node)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getNodeAttr(String attrName, Node node) { NamedNodeMap attrs = node.getAttributes(); for (int y = 0; y < attrs.getLength(); y++) { Node attr = attrs.item(y); if (attr.getNodeName().equalsIgnoreCase(attrName)) { return attr.getNodeValue(); }//from w w w . j a v a2 s . c o m } return ""; } }