Java tutorial
//package com.java2s; public class Main { public static void appendTextNode(StringBuilder sb, String param, String content) { appendXmlBegin(sb, param); sb.append(content); appendXmlEnd(sb, param); } public static void appendTextNode(StringBuilder sb, String param, int content) { appendXmlBegin(sb, param); sb.append(content); appendXmlEnd(sb, param); } public static void appendXmlBegin(StringBuilder sb, String param) { sb.append("<"); sb.append(param); sb.append(">"); } public static void appendXmlEnd(StringBuilder sb, String param) { sb.append("</"); sb.append(param); sb.append(">"); } }