Here you can find the source of getDocumentBuilder()
public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
//package com.java2s; //License from project: LGPL import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { private static DocumentBuilderFactory documentBuilderFactory; private static DocumentBuilder documentBuilder; public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { if (documentBuilder == null) { documentBuilder = newDocumentBuilder(); }/*from w w w . j av a 2s . co m*/ return documentBuilder; } public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { return getDocumentBuilderFactory().newDocumentBuilder(); } public static DocumentBuilderFactory getDocumentBuilderFactory() { if (documentBuilderFactory == null) { documentBuilderFactory = DocumentBuilderFactory.newInstance(); } return documentBuilderFactory; } }