Java XML DocumentBuilder Create newDocumentBuilder()

Here you can find the source of newDocumentBuilder()

Description

new Document Builder

License

Apache License

Declaration

public static DocumentBuilder newDocumentBuilder() 

Method Source Code

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

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

public class Main {
    public static DocumentBuilder newDocumentBuilder() {
        return newDocumentBuilder(true);
    }//from  w  w  w  .j a va  2 s.  c  om

    public static DocumentBuilder newDocumentBuilder(boolean validating) {

        try {

            DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
            dbfac.setNamespaceAware(true);
            dbfac.setValidating(validating);

            return dbfac.newDocumentBuilder();

        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. getDocumentBuilderFactoryClassName()
  2. getNewDocumentBuilder()
  3. getNewDocumentBuilder()
  4. newDocumentBuilder()
  5. newDocumentBuilder()
  6. newDocumentBuilder()
  7. newDocumentBuilder()
  8. newDocumentBuilder()
  9. newDocumentBuilder()