Here you can find the source of getNamedAttribute(final Node aNode, final String attributeName)
private static String getNamedAttribute(final Node aNode, final String attributeName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { private static String getNamedAttribute(final Node aNode, final String attributeName) { // Fail fast if (aNode == null) { return null; }//from w ww . j a v a2s . c o m final NamedNodeMap attributes = aNode.getAttributes(); if (attributes != null) { final Node nameNode = attributes.getNamedItem(attributeName); if (nameNode != null) { return nameNode.getNodeValue().trim(); } } // Not found. return null; } }