Java XML Document Parse parseDocument(Path xmlPath)

Here you can find the source of parseDocument(Path xmlPath)

Description

parse Document

License

Open Source License

Declaration

public static Document parseDocument(Path xmlPath)
            throws ParserConfigurationException, SAXException, IOException 

Method Source Code


//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
}

Related

  1. parseDocument(InputStream in)
  2. parseDocument(InputStream is)
  3. parseDocument(InputStream is)
  4. parseDocument(InputStream is)
  5. parseDocument(InputStream is)
  6. parseDocument(Reader reader)
  7. parseDocument(String docText)
  8. parseDocument(String documentString)
  9. parseDocument(String documentString)