Here you can find the source of parse(File f)
public static Document parse(File f) throws SAXException, IOException
//package com.java2s; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.net.URL; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class Main { private static DocumentBuilder dBuilder; public static Document parse(File f) throws SAXException, IOException { return dBuilder.parse(f); }/*from w w w . j av a 2 s. co m*/ public static Document parse(InputSource is) throws SAXException, IOException { return dBuilder.parse(is); } public static Document parse(InputStream is) throws SAXException, IOException { return dBuilder.parse(is); } /** * Parse an XML string, NOT that parse(uri) method from the Java APIs. * @param xml A XML String */ public static Document parse(String xml) throws SAXException, IOException { return dBuilder.parse(new InputSource(new StringReader(xml))); } /** * Parses XML from over the network. */ public static Document parse(URL uri) throws SAXException, IOException { return dBuilder.parse(uri.toExternalForm()); } public static Document parse(InputStream is, String systemId) throws SAXException, IOException { return dBuilder.parse(is, systemId); } }