Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.IOException;
import java.io.InputStream;

import javax.xml.parsers.DocumentBuilder;

import org.w3c.dom.Document;

import org.xml.sax.SAXException;

public class Main {
    private static DocumentBuilder docBuilder;

    public static Document createDocument(InputStream is) throws SAXException, IOException {
        try {
            return docBuilder.parse(is);
        } finally {
            is.close();
        }
    }

    public static Document createDocument() {
        return docBuilder.newDocument();
    }
}