Java XML Document Create newDocument()

Here you can find the source of newDocument()

Description

Creates a new Document using the default XML implementation

License

Apache License

Return

DOM

Declaration

public static Document newDocument() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

import org.w3c.dom.Document;

public class Main {
    /**//from   www  .j  a  va2  s.  c o  m
     * Document builder factory
     */
    private static DocumentBuilderFactory factory = null;

    /**
     * Creates a new Document using the default XML implementation
     * 
     * @return DOM
     */
    public static Document newDocument() {
        try {
            return factory.newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}

Related

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