Here you can find the source of getDocumentBuilder()
private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
//package com.java2s; /* J_LZ_COPYRIGHT_BEGIN ******************************************************* * Copyright 2006-2008, 2011 Laszlo Systems, Inc. All Rights Reserved. * * Use is subject to license terms. * * J_LZ_COPYRIGHT_END *********************************************************/ 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; private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { DocumentBuilder builder = documentBuilder; if (builder == null) { builder = getDocumentBuilderFactory().newDocumentBuilder(); documentBuilder = builder;/* w ww . ja v a 2 s . c o m*/ } else { try { builder.reset(); } catch (UnsupportedOperationException e) { } } return builder; } private static DocumentBuilderFactory getDocumentBuilderFactory() { DocumentBuilderFactory factory = documentBuilderFactory; if (factory == null) { factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); documentBuilderFactory = factory; } return factory; } }