Here you can find the source of setAttribute(final Element element, final String attrName, final Object value)
public static void setAttribute(final Element element, final String attrName, final Object value)
//package com.java2s; // ProjectForge is dual-licensed. import org.w3c.dom.Element; public class Main { public static void setAttribute(final Element element, final String attrName, final Object value) { if (value == null) { element.setAttribute(attrName, ""); } else {//www . jav a 2 s .co m element.setAttribute(attrName, String.valueOf(value)); } } }