Here you can find the source of parseDocument(Path xmlPath)
public static Document parseDocument(Path xmlPath) throws ParserConfigurationException, SAXException, IOException
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Document; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.IOException; import java.nio.file.Path; public class Main { public static Document parseDocument(Path xmlPath) throws ParserConfigurationException, SAXException, IOException { File fXmlFile = new File(xmlPath.toUri()); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); return dBuilder.parse(fXmlFile); }// w ww .j a va2 s . co m }