Reading an XML from a file system path
XML file can be manipulated when converted to the Document class. To read an XML file from a path on the file system and convert it to the Document class, we can use the DocumentBuilderFactory.
An example method is shown below:
public Document readXml(String absolutePath) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance(); DocumentBuilder db =dbf.newDocumentBuilder(); return (Document) db.parse(absolutePath); }








