Here you can find the source of getAttributeValue(Node n, String name)
Parameter | Description |
---|---|
n | a parameter |
name | a parameter |
public static String getAttributeValue(Node n, String name)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /**/* w w w . jav a 2 s. c o m*/ * Lookup an attribute from a DOM node. * @param n * @param name * @return */ public static String getAttributeValue(Node n, String name) { NamedNodeMap nm = n.getAttributes(); for (int i = 0; i < nm.getLength(); i++) { Node node = nm.item(i); if (name.equals(node.getNodeName())) { return node.getNodeValue(); } } return ""; } }