Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { public static DocumentBuilder getSyncDocumentBuilder(boolean namespaceAware) throws ParserConfigurationException { return getSyncDocumentBuilder(namespaceAware, false, false); } public static synchronized DocumentBuilder getSyncDocumentBuilder(boolean namespaceAware, boolean coalescing, boolean ignoringElementContentWhitespace) throws ParserConfigurationException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(namespaceAware); domFactory.setCoalescing(coalescing); domFactory.setIgnoringElementContentWhitespace(ignoringElementContentWhitespace); return domFactory.newDocumentBuilder(); } }