Here you can find the source of getAttributeValue(final Element element, final String attributeName)
Parameter | Description |
---|---|
element | XML element |
attributeName | Attribute name |
public static String getAttributeValue(final Element element, final String attributeName)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Attr; import org.w3c.dom.Element; public class Main { /**/*from www . j ava 2 s .c o m*/ * Get XML element's attribute value * @param element XML element * @param attributeName Attribute name * @return Attribute value */ public static String getAttributeValue(final Element element, final String attributeName) { String attributeValue = ""; Attr attribute = element.getAttributeNode(attributeName); if (null != attribute) { attributeValue = attribute.getValue(); } return attributeValue; } }