Here you can find the source of getAttributeValue(final Element el, final String attrName)
public static String getAttributeValue(final Element el, final String attrName)
//package com.java2s; //License from project: Apache License import javax.xml.namespace.QName; import org.w3c.dom.Element; public class Main { public static String getAttributeValue(final Element el, final String attrName) { return getAttributeValue(el, new QName(attrName)); }//from w w w. j a v a 2s . c o m public static String getAttributeValue(final Element el, final String attrName, final String defaultVal) { final String retval = getAttributeValue(el, new QName(attrName)); return retval == null ? defaultVal : retval; } public static String getAttributeValue(final Element el, final QName attrName) { String attr = null; if ("".equals(attrName.getNamespaceURI())) { attr = el.getAttribute(attrName.getLocalPart()); } else { attr = el.getAttributeNS(attrName.getNamespaceURI(), attrName.getLocalPart()); } if ("".equals(attr)) { attr = null; } return attr; } }