Java XML Document Create getNewDocument()

Here you can find the source of getNewDocument()

Description

get New Document

License

Open Source License

Declaration

public static Document getNewDocument() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Dipanjan Das // w w w  . j a v  a  2  s.  c  o  m
 * Language Technologies Institute, 
 * Carnegie Mellon University, 
 * All Rights Reserved.
 * 
 * XmlUtils.java is part of SEMAFOR 2.0.
 * 
 * SEMAFOR 2.0 is free software: you can redistribute it and/or modify  it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * SEMAFOR 2.0 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 for more details. 
 * 
 * You should have received a copy of the GNU General Public License along
 * with SEMAFOR 2.0.  If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/

import org.w3c.dom.Document;

public class Main {
    public static Document getNewDocument() {
        Document doc = null;
        //initializing the DOM object to load the XML object into
        try {
            javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory
                    .newInstance();
            javax.xml.parsers.DocumentBuilder docbuilder = factory
                    .newDocumentBuilder();
            doc = docbuilder.newDocument();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return doc;
    }
}

Related

  1. getDocument(String xml)
  2. getDocument(String xml)
  3. getDocument(String xmlDocument)
  4. getDocument(String xslName)
  5. getDocument(URL location, boolean validating, boolean namespaceAware)
  6. getNewDocument()
  7. getNewXmlDocument()
  8. newDocument()
  9. newDocument()