Here you can find the source of getDocumentBuilder()
public static DocumentBuilder getDocumentBuilder()
//package com.java2s; /*//from w w w .ja v a 2 s. c o m Copyright (C) 2007-2011 BlueXML - www.bluexml.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { private static DocumentBuilder documentBuilder = null; /** * Gets a namespace aware non-validating DocumentBuilder object. If non existent, the object is * created. * * @return */ public static DocumentBuilder getDocumentBuilder() { if (documentBuilder == null) { try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(true); // @since 1.0.2 docBuilderFactory.setValidating(false); // @since 1.0.2 documentBuilder = docBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); return null; } } return documentBuilder; } }