Java tutorial
//package com.java2s; import org.w3c.dom.Node; public class Main { /** * Queries the value of an attribute of a given xml node * * @param n xml node * @param attribute name of the attribute * @return assigned value for the attribute in that node */ public static String getAttributeValue(Node n, String attribute) { return n.getAttributes().getNamedItem(attribute).getNodeValue(); } }