Java XML Document Create createDocument()

Here you can find the source of createDocument()

Description

Create a new W3C Document.

License

Open Source License

Exception

Parameter Description
ConfigurationException an exception

Return

The new Document instance.

Declaration

public static Document createDocument() throws ConfigurationException 

Method Source Code

//package com.java2s;
// License as published by the Free Software Foundation; either

import javax.naming.ConfigurationException;

import javax.xml.parsers.DocumentBuilderFactory;

import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;

public class Main {
    /**/*  ww  w  .j  a v  a 2  s  .co m*/
     * Create a new W3C Document.
     * <p/>
     * Handles exceptions etc.
     * @return The new Document instance.
     * @throws ConfigurationException 
     */
    public static Document createDocument() throws ConfigurationException {
        Document doc = null;

        try {
            doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException e) {
            throw new ConfigurationException("Failed to create ESB Configuration Document instance.");
        }

        return doc;
    }
}

Related

  1. createDocument()
  2. createDocument()
  3. createDocument()
  4. createDocument()
  5. createDocument()
  6. createDocument()