title: remove xml declaration from the generated xml document using java
body: <pre><code>String root = "RdbTunnels";
  DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
  DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
  Document document = documentBuilder.newDocument();
  Element rootElement = document.createElement(root);
  document.appendChild(rootElement);   
  
  OutputFormat format = new OutputFormat(document);
  format.setIndenting(true);
  
  
  XMLSerializer serializer = new XMLSerializer(System.out, format);
  serializer.serialize(document);
  </code></pre>
  
  <p>gives the result as following</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;RdbTunnels/&gt;
  </code></pre>
  
  <p>but I need to remove the xml declaration from the output how can I do that</p>