Here you can find the source of setAttribute(Element element, String attributeName, String value)
public static void setAttribute(Element element, String attributeName, String value)
//package com.java2s; import org.w3c.dom.*; public class Main { public static void setAttribute(Element element, String attributeName, String value) { if (value != null) { element.setAttribute(attributeName, value); }/*from ww w .j a va2 s. c o m*/ } }