Java tutorial
//package com.java2s; import org.w3c.dom.CDATASection; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static void setCDATAContent(Node node, String value) { NodeList nodeList = node.getChildNodes(); if (nodeList != null) { for (int i = 0; i < nodeList.getLength(); i++) { Node child = nodeList.item(i); if (child.getNodeType() == Node.CDATA_SECTION_NODE) { CDATASection cdata = (CDATASection) child; cdata.setData(value); } } } } }