Here you can find the source of getDocumentBuilder()
public static DocumentBuilder getDocumentBuilder()
//package com.java2s; /******************************************************************************* * Copyright (c) 2008, 2009 SOPERA GmbH. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w .j ava 2s . c om * SOPERA GmbH - initial API and implementation *******************************************************************************/ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.springframework.util.Assert; public class Main { private static DocumentBuilderFactory builderFactory; public static DocumentBuilder getDocumentBuilder() { DocumentBuilder builder = null; if (builderFactory == null) { builderFactory = DocumentBuilderFactory.newInstance(); builderFactory.setNamespaceAware(true); } try { builder = builderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } Assert.notNull(builder); return builder; } }