Here you can find the source of setAttributeValue(Node node, String attribute, String value)
public static void setAttributeValue(Node node, String attribute, String value)
//package com.java2s; //License from project: Apache License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static void setAttributeValue(Node node, String attribute, String value) { NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { Node nameAttr = attributes.getNamedItem(attribute); if (nameAttr != null) { nameAttr.setNodeValue(value); }/* w ww . j av a 2s. c o m*/ } } }