Here you can find the source of parseDocument(File f)
public static Document parseDocument(File f) throws SAXException, IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class Main { private static DocumentBuilder builder; public static Document parseDocument(File f) throws SAXException, IOException { InputStream stream = new FileInputStream(f); Document doc = builder.parse(stream); stream.close();// www . j av a 2s.c om return doc; } }