Here you can find the source of setAttributeValue(final Element target, final String attributeName, final String value)
public static boolean setAttributeValue(final Element target, final String attributeName, final String value)
//package com.java2s; //License from project: Apache License import org.w3c.dom.*; public class Main { public static boolean setAttributeValue(final Element target, final String attributeName, final String value) { final NamedNodeMap map = target.getAttributes(); final Node attributeValueHolder = map.getNamedItem(attributeName); if (attributeValueHolder != null) { attributeValueHolder.setNodeValue(value); return true; }/*from w w w. ja v a 2 s .com*/ return false; } }