Here you can find the source of newDocumentBuilder(boolean ignoreWhitespace, boolean ignoreComment)
public static DocumentBuilder newDocumentBuilder(boolean ignoreWhitespace, boolean ignoreComment)
//package com.java2s; //License from project: Open Source License import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { public static DocumentBuilder newDocumentBuilder(boolean ignoreWhitespace, boolean ignoreComment) { try {// w w w. j a v a 2 s . c om DocumentBuilderFactory dbf = createDefaultDocumentBuilderFactory(); dbf.setIgnoringElementContentWhitespace(ignoreWhitespace); dbf.setIgnoringComments(ignoreComment); return dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { //not occur e.printStackTrace(); throw new IllegalStateException(e); } } public static final DocumentBuilderFactory createDefaultDocumentBuilderFactory() { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setCoalescing(true); dbf.setExpandEntityReferences(true); dbf.setIgnoringComments(true); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); dbf.setValidating(false); dbf.setXIncludeAware(true); return dbf; } }