Here you can find the source of setAttribute(Node node, String key, String value)
Parameter | Description |
---|---|
node | a parameter |
key | a parameter |
value | a parameter |
public static void setAttribute(Node node, String key, String value)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { public static void setAttribute(Node node, String key, String value) { Node attributeNode = node.getOwnerDocument().createAttribute(key); attributeNode.setNodeValue(value); node.getAttributes().setNamedItem(attributeNode); }//from w w w . ja v a 2 s . c o m }