Here you can find the source of getAttributeValue(Node node, String attrName)
Parameter | Description |
---|---|
node | a parameter |
attrName | a parameter |
static String getAttributeValue(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 { /**/*from w ww . java 2s . co m*/ * Gets the value of a specific attribute attached to the given node * @param node * @param attrName * @return */ static String getAttributeValue(Node node, String attrName) { if (node == null) return null; ; NamedNodeMap map = node.getAttributes(); if (map != null && map.getNamedItem(attrName) != null) return map.getNamedItem(attrName).getTextContent(); else return null; } }