Here you can find the source of loadFile(Context context, String fileName)
public static Document loadFile(Context context, String fileName)
//package com.java2s; import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import android.content.Context; public class Main { public static Document loadFile(Context context, String fileName) { File cacheDir = context.getCacheDir(); File file = new File(cacheDir, fileName); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db;/*from www. j a v a2 s .co m*/ Document document = null; try { db = dbf.newDocumentBuilder(); document = db.parse(file); document.getDocumentElement().normalize(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return document; } }