package org.apache.tuscany.sca.impl.io; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class XMLReader { //get the factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); private Document dom; public Document parseXMLFile(String file) throws Exception { //Using factory get an instance of document builder DocumentBuilder db = dbf.newDocumentBuilder(); //parse using builder to get DOM representation of the XML file dom = db.parse(file); return dom; } }