Java tutorial
//package com.java2s; import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { /** * Parses the File into a DOM Document. * @param file the file to parse * @return Document - the parsed DOM Document */ public static Document getDocument(File file) { DocumentBuilder builder; try { builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.parse(file); } catch (Exception e) { e.printStackTrace(); return null; } } }