Java XML Document Create getDocument()

Here you can find the source of getDocument()

Description

get Document

License

Apache License

Declaration

public static Document getDocument() 

Method Source Code


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

import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

public class Main {

    public static Document getDocument() {
        Document document = null;
        DocumentBuilder db;/*from ww  w. j  a  v a  2  s .  com*/
        try {
            db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            document = db.parse("src/exam.xml");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return document;
    }
}

Related

  1. createEmptyDocument(final DocumentBuilder builder)
  2. createEmptyElement(Document doc, QName qname)
  3. createNewDocument()
  4. createNewDocument(DocumentBuilder docBuilder)
  5. createNewDocument(String namespaceURI, String qualifiedName)
  6. getDocument()
  7. getDocument()
  8. getDocument(Document document)
  9. getDocument(DOMSource source)