Java examples for XML:XML Attribute
get XML Attribute Value
//package com.java2s; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /**/* ww w . ja va 2 s .com*/ * @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(); } }