Here you can find the source of appendCDATASection(Node parent, String name, Object data)
public static void appendCDATASection(Node parent, String name, Object data)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static void appendCDATASection(Node parent, String name, Object data) { Document doc = (parent.getNodeType() == Node.DOCUMENT_NODE) ? (Document) parent : parent.getOwnerDocument(); Element e = doc.createElement(name); parent.appendChild(e);//from www . j a v a 2s . co m e.appendChild(doc.createCDATASection(data.toString())); } }