Here you can find the source of getDocumentBuilder()
private static DocumentBuilder getDocumentBuilder()
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { /**// www. j a va 2 s . c o m * singleton */ private static DocumentBuilderFactory documentBuilderFactory = null; /** * DocumentBuilder instance * * @return */ private static DocumentBuilder getDocumentBuilder() { try { return getDocumentBuilderFactory().newDocumentBuilder(); } catch (ParserConfigurationException e) { return null; } } /** * DocumentBuilderFactory instance (lazy initialization) * * @return */ private static DocumentBuilderFactory getDocumentBuilderFactory() { if (documentBuilderFactory == null) { documentBuilderFactory = DocumentBuilderFactory.newInstance(); } return documentBuilderFactory; } }