Here you can find the source of readFile(String xmlFile)
public static String readFile(String xmlFile)
//package com.java2s; //License from project: Common Public License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; public class Main { public static String readFile(String xmlFile) { StringBuffer fileContent = new StringBuffer(); try {// w w w. ja v a2 s .c o m FileReader reader = new FileReader(new File(xmlFile)); BufferedReader buffer = new BufferedReader(reader); String line = ""; int i = 0; while ((line = buffer.readLine()) != null) { if (i != 0) fileContent.append("\n"); i++; fileContent.append(line); } reader.close(); } catch (Exception ex) { } return fileContent.toString(); } }