Here you can find the source of appendBooleanAttribute(Element thisElement, String attrName, boolean value)
public static void appendBooleanAttribute(Element thisElement, String attrName, boolean value)
//package com.java2s; /**//from ww w .j a va2s . c o m * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Copyright 2011 GrossCommerce */ import org.w3c.dom.Attr; import org.w3c.dom.Element; public class Main { public static void appendBooleanAttribute(Element thisElement, String attrName, boolean value) { appendStringAttribute(thisElement, attrName, String.valueOf(value)); } public static void appendStringAttribute(Element thisElem, String attrName, String attrValue) { Attr attr = thisElem.getOwnerDocument().createAttribute(attrName); attr.setTextContent(attrValue); thisElem.setAttributeNode(attr); } }