Java XML Document Create createDocument()

Here you can find the source of createDocument()

Description

create Document

License

Apache License

Declaration

public static Document createDocument() throws ParserConfigurationException, IOException, SAXException 

Method Source Code


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

import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    static DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();

    public static Document createDocument(InputStream inputStream)
            throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        return dBuilder.parse(inputStream);
    }//from ww w. j  ava  2  s .  c om

    public static Document createDocument() throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        return dBuilder.newDocument();
    }
}

Related

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