public static Document createDocument(boolean isSecureProcessing){
  try {
    DocumentBuilderFactory dfactory=DocumentBuilderFactory.newInstance();
    dfactory.setNamespaceAware(true);
    DocumentBuilder docBuilder=dfactory.newDocumentBuilder();
    Document outNode=docBuilder.newDocument();
    return outNode;
  }
 catch (  ParserConfigurationException pce) {
    throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED,null));
  }
}

public static Document createDocument ( boolean isSecureProcessing ) { try { DocumentBuilderFactory dfactory = DocumentBuilderFactory . newInstance ( ) ; dfactory . setNamespaceAware ( true ) ; DocumentBuilder docBuilder = dfactory . newDocumentBuilder ( ) ; Document outNode = docBuilder . newDocument ( ) ; return outNode ; } catch ( ParserConfigurationException pce ) { throw new RuntimeException ( XMLMessages . createXMLMessage ( XMLErrorResources . ER_CREATEDOCUMENT_NOT_SUPPORTED , null ) ) ; } }
dom level 1 did not have a standard mechanism for creating a new document object . this function provides a dom - implementation - independent abstraction for that for that concept . it ' s typically used when outputting a new dom as the result of an operation . < p > todo : this isn ' t directly compatable with dom level 2 . the level 2 createdocument call also creates the root element , and thus requires that you know what that element will be before creating the document . we should think about whether we want to change this code , and the callers , so we can use the dom ' s own method . ( it ' s also possible that dom level 3 may relax this sequence , but you may give up some intelligence in the dom by doing so ; the intent was that knowing the document type and root element might let the dom automatically switch to a specialized subclass for particular kinds of documents . )
