Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;

public class Main {
    /**
     * Create a new blank XML document.
     *
     * @return The new blank XML document.
     *
     * @throws IOException If there is an error creating the XML document.
     */
    public static Document newDocument() throws IOException {
        try {
            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = builderFactory.newDocumentBuilder();
            return builder.newDocument();
        } catch (Exception e) {
            IOException thrown = new IOException(e.getMessage());
            throw thrown;
        }
    }
}