Java tutorial
//package com.java2s; import java.io.File; import java.io.FileInputStream; public class Main { public static String convertXmlToString(String xmlFileName) throws Exception { File file = new File(xmlFileName); FileInputStream insr = new FileInputStream(file); byte[] fileBuffer = new byte[(int) file.length()]; insr.read(fileBuffer); insr.close(); return new String(fileBuffer); } }