Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { static public String getAttributeValue(Node node, String name) { Node attr = getAttribute(node, name); return (attr != null) ? attr.getNodeValue() : null; } public static String getAttribute(Element element, String name) { Attr attr = element.getAttributeNode(name); return (attr != null) ? attr.getValue() : null; } static public Node getAttribute(Node node, String name) { return node.getAttributes().getNamedItem(name); } }