Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; public class Main { private static DocumentBuilderFactory documentBuilderFactory; private static DocumentBuilder documentBuilder; private synchronized static void initializeDocumentBuilder() throws Exception { if (documentBuilder == null) { documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(false); documentBuilder = documentBuilderFactory.newDocumentBuilder(); } } }