Java XML Document Create createDocument()

Here you can find the source of createDocument()

Description

create Document

License

Open Source License

Declaration

public static Document createDocument() 

Method Source Code

//package com.java2s;
/*//from w w  w.  ja v a 2 s.co m
 * Keystone Development Framework
 * Copyright (C) 2004-2009 Rick Knowles
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * Version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License Version 2 for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * Version 2 along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

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

import org.w3c.dom.Document;

public class Main {
    public static Document createDocument() {
        try {
            // Use JAXP to create a document builder
            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();

            builderFactory.setExpandEntityReferences(false);
            builderFactory.setValidating(false);
            builderFactory.setNamespaceAware(true);
            builderFactory.setIgnoringComments(true);
            builderFactory.setCoalescing(true);
            builderFactory.setIgnoringElementContentWhitespace(true);

            return builderFactory.newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException errParser) {
            throw new RuntimeException("Error getting XML parser", errParser);
        }
    }
}

Related

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