Java tutorial
//package com.java2s; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /** * @param node * @param attributeKey * @return */ public static String getAttributeValue(Node node, String attributeKey) { NamedNodeMap attributes = node.getAttributes(); Node attribute = attributes.getNamedItem(attributeKey); if (attribute == null) { return null; } return attribute.getNodeValue(); } }