Java XML Attribute Set setAttribute(final Element element, final String attrName, final Object value)

Here you can find the source of setAttribute(final Element element, final String attrName, final Object value)

Description

set Attribute

License

Open Source License

Declaration

public static void setAttribute(final Element element, final String attrName, final Object value) 

Method Source Code

//package com.java2s;
// ProjectForge is dual-licensed.

import org.w3c.dom.Element;

public class Main {
    public static void setAttribute(final Element element, final String attrName, final Object value) {
        if (value == null) {
            element.setAttribute(attrName, "");
        } else {//www  .  jav  a  2 s  .co m
            element.setAttribute(attrName, String.valueOf(value));
        }
    }
}

Related

  1. setAttribute(Element element, String attributeName, String attributeValue)
  2. setAttribute(Element element, String attributeName, String value)
  3. setAttribute(Element element, String attrName, Object value)
  4. setAttribute(Element element, String name, String value)
  5. setAttribute(Element targetElem, String name, String value)
  6. setAttribute(final Element element, final String name, final String value)
  7. setAttribute(Node n, String name, String value)
  8. setAttribute(Node node, String attName, String val)
  9. setAttribute(Node node, String attr, String value)