Java examples for XML:DOM Document
get XML Document from File
//package com.java2s; import javax.xml.parsers.*; import org.w3c.dom.*; public class Main { public static Document getDocument(String path_to_file) { Document d = null;/*ww w .ja v a 2 s.c o m*/ try { DocumentBuilderFactory dbf = DocumentBuilderFactory .newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); d = db.parse(path_to_file); } catch (Exception ex) { d = null; } return d; } }