Java XML Document Create newDocument(File file)

Here you can find the source of newDocument(File file)

Description

new Document

License

Open Source License

Declaration

public static Document newDocument(File file) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;

public class Main {
    public static Document newDocument(File file) {
        try {//  w  w w.  j a  v a2s . c om
            return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
        } catch (Exception e) {
            throw new IllegalStateException("Error parsing project set file: ".concat(file.getAbsolutePath()), e);
        }
    }
}

Related

  1. newDocument()
  2. newDocument()
  3. newDocument()
  4. newDocument()
  5. newDocument(boolean isNamespaceAware, boolean isValidating)
  6. newDocument(String namespaceURI, String qualifiedName)
  7. newDocument(String rootName)
  8. newXMLDocument()
  9. newXMLDocument()