Java tutorial
//package com.java2s; import org.w3c.dom.Node; public class Main { public static String getAttribute(Node node, String name) { if (node.getAttributes().getLength() > 0) { if (node.getAttributes().getNamedItem(name) != null) return (node.getAttributes().getNamedItem(name).getNodeValue()); } return ""; } }