Java examples for XML:XML Attribute
get Attribute Value from Node
//package com.java2s; import org.w3c.dom.Node; public class Main { public static String getAttributeValue(Node node, String attributeName) { if (node == null || node.getAttributes() == null || node.getAttributes().getNamedItem(attributeName) == null) { return null; }/*from w w w . j a v a 2 s . c o m*/ return node.getAttributes().getNamedItem(attributeName) .getNodeValue(); } }