Java tutorial
//package com.java2s; public class Main { public static String toXml(String fieldName, String fieldValue) { StringBuffer xmlBuf = new StringBuffer(); xmlBuf.append(startTag(fieldName)); xmlBuf.append(fieldValue); xmlBuf.append(endTag(fieldName)); return xmlBuf.toString(); } public static String startTag(String tagData) { return "<" + tagData + ">"; } public static String endTag(String tagData) { return "</" + tagData + ">"; } }