Java examples for XML:XML String
Add boolean Content to XML Tag
//package com.java2s; import org.w3c.dom.Element; public class Main { static public void booleanContentTag(Element parent, String tagName, boolean content) { Element tag = parent.getOwnerDocument().createElement(tagName); if (content) tag.setTextContent("1"); else//from w ww . j a v a 2 s. co m tag.setTextContent("0"); parent.appendChild(tag); } static public Element createElement(Element parent, String tagName) { Element tag = parent.getOwnerDocument().createElement(tagName); parent.appendChild(tag); return tag; } }