Set the value of XML attribute - Java XML

Java examples for XML:XML Attribute

Description

Set the value of XML attribute

Demo Code


//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    /**// ww w . ja  v  a2  s  .c  om
     * Set the value of attribute
     *
     * @param element
     * @param attr
     * @param attrVal
     */
    public static void setElementAttr(Element element, String attr,
            String attrVal) {
        element.setAttribute(attr, attrVal);
    }
}

Related Tutorials