Java tutorial
//package com.java2s; import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; public class Main { public static Document readXMLFile(String filename) throws IOException { DocumentBuilder builder; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { builder = factory.newDocumentBuilder(); Document document = builder.parse(filename); return document; } catch (Exception e) { throw new IOException(); } } }