Java XML Document Create createDocument()

Here you can find the source of createDocument()

Description

Returns a new, empty DOM document.

License

Open Source License

Return

Returns a new DOM document.

Declaration

public static Document createDocument() 

Method Source Code

//package com.java2s;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;

public class Main {
    /**/* w  ww .  j av a  2 s .c o m*/
     * Returns a new, empty DOM document.
     * 
     * @return Returns a new DOM document.
     */
    public static Document createDocument() {
        Document result = null;

        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory
                    .newInstance();
            DocumentBuilder parser = factory.newDocumentBuilder();

            result = parser.newDocument();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        return result;
    }
}

Related

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