Java tutorial
//package com.java2s; // Licensed to the Apache Software Foundation (ASF) under one import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getAttribute(Node node, String name) { NamedNodeMap attributes = node.getAttributes(); Node attrNode = attributes.getNamedItem(name); if (attrNode != null) return attrNode.getNodeValue(); return null; } }