title: DOM XML Public Doctype not appearing in result xml file
body: <p>I have written a code to generate XML files. I am stuck at defining doctype for the XML as it should be public. I am able to get SYSTEM doctype successfully but somehow not able to get public doctype written in XML. Below code for SYSTEM doctype is working but same snippet for PUBLIC doctype is not working : </p>
  
  <pre><code>String xmldestpath = "C:/failed/tester.xml";
          doctype2 = CreateDoctypeString();
  
          StreamResult result =  new StreamResult(new File(xmldestpath ));
            try {
                transformer = transformerFactory.newTransformer();
                transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"TEST");
                transformer.transform(source, result);
      //        logger.debug("COMPLETED Copying xml files /....!!");            
  
              System.out.println("COMPLETED Copying xml files to bulk import....!!");
  </code></pre>
  
  <p>Not working snippet. Its not giving error but no doctype is appearing in resultant xml: </p>
  
  <pre><code> String xmldestpath = "C:/failed/tester.xml";
      doctype2 = CreateDoctypeString();
  
      StreamResult result =  new StreamResult(new File(xmldestpath ));
        try {
            transformer = transformerFactory.newTransformer();
            transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,"TEST");
            transformer.transform(source, result);
  //        //logger.debug("COMPLETED Copying xml files /....!!");              
  
          System.out.println("COMPLETED Copying xml files to bulk import....!!");
  </code></pre>