Java tutorial
//package com.java2s; public class Main { public static void appendCDdataElement(StringBuilder sb, String tagName, String value) { appendTagPre(sb, tagName); sb.append("<![CDATA[").append(value).append("]]>"); appendTagPost(sb, tagName); } public static void appendTagPre(StringBuilder sb, String tagName) { sb.append("<").append(tagName).append(">"); } public static void appendTagPost(StringBuilder sb, String tagName) { sb.append("</").append(tagName).append(">"); } }