Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilderFactory; public class Main { private static DocumentBuilderFactory documentBuilderFactory; /** * Gets the document builder factory, creating it if necessary. * * @return the document builder factory. */ public static synchronized DocumentBuilderFactory getDocumentBuilderFactory() { if (documentBuilderFactory == null) { documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); } return documentBuilderFactory; } }