Here you can find the source of xmlGetAttribute2(Node node, String attrname)
public static void xmlGetAttribute2(Node node, String attrname)
//package com.java2s; //License from project: Apache License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static void xmlGetAttribute2(Node node, String attrname) { NamedNodeMap attrs = node.getAttributes(); if (attrs != null) { for (int i = 0; i < attrs.getLength(); i++) { Node attr = attrs.item(i); /*/*from ww w . ja v a2s. c o m*/ System.out.println("attr.getNodeName() = " + attr.getNodeName()); System.out.println("attr.getLocalName() = " + attr.getLocalName()); System.out.println("attr.getNodeValue() = " + attr.getNodeValue()); */ } } } }