Java XML Document Create newDocument()

Here you can find the source of newDocument()

Description

new Document

License

Open Source License

Declaration

public static Document newDocument() throws IOException 

Method Source Code

//package com.java2s;
/*//from   ww w .j  av a  2s.  c  o  m
 * (c) Kitodo. Key to digital objects e. V. <contact@kitodo.org>
 *
 * This file is part of the Kitodo project.
 *
 * It is licensed under GNU General Public License version 3 or later.
 *
 * For the full copyright and license information, please read the
 * GPL3-License.txt file that was distributed with this source code.
 */

import java.io.IOException;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;

public class Main {

    public static Document newDocument() throws IOException {
        try {
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            return documentBuilderFactory.newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException e) {
            throw new IOException(e.getMessage(), e);
        }
    }
}

Related

  1. getNewDocument()
  2. getNewDocument()
  3. getNewXmlDocument()
  4. newDocument()
  5. newDocument()
  6. newDocument()
  7. newDocument()
  8. newDocument()
  9. newDocument()