Java tutorial
//package com.java2s; public class Main { /** * Return the very first line of an XML file. * Beware : the encoding used in xml is not the same as the one returned * by the java Writer's getEncoding methods. writeFirstLine take care of it * @see EncodingMap.getXMLFromJava(String) */ public static String getFirstLine(String xmlEncoding) { StringBuffer sb = new StringBuffer(64); sb.append("<?xml version=\"1.0\" encoding=\""); sb.append(xmlEncoding); sb.append("\" standalone=\"yes\"?>"); return sb.toString(); } }