Java tutorial
//package com.java2s; /* * JLib - Publicitas Java library. * * Copyright (c) 2005, 2006, 2007, 2008 Publicitas SA. * Licensed under LGPL (LGPL-LICENSE.txt) license. */ import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /** * Sets the content of an attribute in the specified node. * If the attribute already exists, its content is modified with the text * specified in <b>value</b>. If the attribute doesn't exist, a new one * (with the name specified in <b>name</b>) is created. * @param node The node that will contain the specified attribute. * @param name The name of the attribute to set the text. * @param value The text to place in the specified attribute. */ public static void SetNodeAttribute(Node node, String name, String value) { Element x = (Element) node; x.setAttribute(name, value); } }