XML Java

import org.w3c.dom.Attr;
import org.w3c.dom.Element;
public class Utils {
  /**
   * Returns null, not "", for a nonexistent attribute.
   * 
   * @param e
   * @param attributeName
   * @return
   */
  public static String getAttributeValueEmptyNull(Element e, String attributeName) {
      Attr node = e.getAttributeNode(attributeName);
      if (node == null) {
          return null;
      }
      return node.getValue();
  }
}