Java examples for XML:XML Node
get Attribute from XML Node by name
//package com.java2s; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getAttribute(Node node, String name) { NamedNodeMap map = node.getAttributes(); if (map != null && map.getNamedItem(name) != null) { return map.getNamedItem(name).getNodeValue(); }//from w w w. ja v a 2s .c o m return null; } }