Java examples for XML:DOM Document
parse File and return XML Document
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import java.io.File; public class Main { public static Document parseDoc(File f) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance();// w w w. j av a 2 s . co m DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(f); } }