Here you can find the source of addCdataNode(Element element, String tagName, String value)
public static void addCdataNode(Element element, String tagName, String value)
//package com.java2s; // Released under the terms of the CPL Common Public License version 1.0. import org.w3c.dom.*; public class Main { public static void addCdataNode(Element element, String tagName, String value) { if (value != null && !(value.equals(""))) { Document document = element.getOwnerDocument(); Element titleElement = document.createElement(tagName); titleElement.appendChild(document.createCDATASection(value)); element.appendChild(titleElement); }/*from w w w . j av a 2s .co m*/ } }