Here you can find the source of attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue)
Parameter | Description |
---|---|
base | the Element to set the attribute on |
name | the attribute name |
value | the value that attribute should be set to |
defaultValue | the default value of the attribute |
public static void attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue)
//package com.java2s; /* Copyright 2004 - 2007 Kasper Nielsen <kasper@codehaus.org> Licensed under * the Apache 2.0 License, see http://coconut.codehaus.org/license. *///from ww w. j a v a 2s.c om import org.w3c.dom.Element; public class Main { /** * Sets an attribute on the specified element with the specified name if the specified * value is different from the specified default value. * * @param base * the Element to set the attribute on * @param name * the attribute name * @param value * the value that attribute should be set to * @param defaultValue * the default value of the attribute */ public static void attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue) { if (value != defaultValue) { base.setAttribute(name, Boolean.toString(value)); } } }