Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; public class Main { private static DocumentBuilder docBuilder_NS_Aware; private static DocumentBuilder docBuilder_NS_Unaware; /** * Initialize the document builder * * @param namespaceAware - indicates which document builder to be initialized * @throws Exception */ private static void initializeDocumentBuilder(boolean namespaceAware) throws Exception { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(namespaceAware); if (namespaceAware) { docBuilder_NS_Aware = documentBuilderFactory.newDocumentBuilder(); } else { docBuilder_NS_Unaware = documentBuilderFactory.newDocumentBuilder(); } } }