Java tutorial
//package com.java2s; /* Copyright (c) 2013 eBay, Inc. This program is licensed under the terms of the eBay Common Development and Distribution License (CDDL) Version 1.0 (the "License") and any subsequent version thereof released by eBay. The then-current version of the License can be found at http://www.opensource.org/licenses/cddl1.php and in the eBaySDKLicense file that is under the eBay SDK ../docs directory. */ import org.w3c.dom.Element; public class Main { /** * * @param parent Element * @param name String * @param value String */ public static void appendAttributeNode(Element parent, String name, String value) { parent.setAttribute(name, value); } /** * * @param namespace String * @param parent Element * @param name String * @param value String */ public static void appendAttributeNode(String namespace, Element parent, String name, String value) { parent.setAttributeNS(namespace, name, value); } /** * * @param parent Element * @param name String * @param value int */ public static void appendAttributeNode(Element parent, String name, int value) { parent.setAttribute(name, new Integer(value).toString()); } /** * * @param namespace String * @param parent Element * @param name String * @param value int */ public static void appendAttributeNode(String namespace, Element parent, String name, int value) { parent.setAttributeNS(namespace, name, new Integer(value).toString()); } }