Java examples for XML:XML Attribute
get Attr Of Name from Node
//package com.java2s; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getAttrOfName(Node node, String string) { NamedNodeMap attributes = node.getAttributes(); Node namedItem = attributes.getNamedItem(string); if (namedItem == null) { return null; }/* w w w. java 2 s.c o m*/ return namedItem.getNodeValue(); } }