Here you can find the source of getValue(final Element elem, final String attrName)
Parameter | Description |
---|---|
elem | attribute parent element |
attrName | attribute name |
public static String getValue(final Element elem, final String attrName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.*; public class Main { /**/*from w w w . j av a 2 s. c o m*/ * Get attribute value. * * @param elem attribute parent element * @param attrName attribute name * @return attribute value, {@code null} if not set */ public static String getValue(final Element elem, final String attrName) { final Attr attr = elem.getAttributeNode(attrName); if (attr != null && !attr.getValue().isEmpty()) { return attr.getValue(); } return null; } }