Here you can find the source of getAttributeValue(Node node, String attributeName)
static String getAttributeValue(Node node, String attributeName)
//package com.java2s; import org.w3c.dom.Node; public class Main { static String getAttributeValue(Node node, String attributeName) { if (node == null || attributeName == null) { return null; }//from w w w .j a v a 2 s. co m Node attrNode = node.getAttributes().getNamedItem(attributeName); return attrNode != null ? attrNode.getNodeValue() : null; } static String getNodeValue(Node node) { return (node == null || node.getFirstChild() == null || node .getFirstChild().getNodeValue() == null) ? null : node .getFirstChild().getNodeValue().trim(); } }