Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilderFactory; public class Main { /** * Creates and configures a DocumentBuilderFactory for use with DOM. The * returned DocumentBuilderFactory is namespace aware and the parsers * constructed with it will not eliminate whitespace in elements. * * @return Properly configured DocumentBuilderFactory */ static DocumentBuilderFactory createDOMFactory() { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); domFactory.setIgnoringElementContentWhitespace(false); return domFactory; } }