Here you can find the source of getAttributeValue(Node n, String name)
Parameter | Description |
---|---|
n | a parameter |
name | a parameter |
private static String getAttributeValue(Node n, String name)
//package com.java2s; /**/*from w ww. j ava 2s. co m*/ * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://www.dspace.org/license/ */ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /** * Lookup an attribute from a DOM node. * @param n * @param name * @return */ private 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 ""; } }