title: How to delete <?xml version="1.0" encoding="UTF-8" standalone="no"?> from xml document
body: <p>I wrote code for tests - it creates simple XML document. My problem is that created document contains unneeded data in first node . Is any way to delete or modify this node <code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;</code> ?</p>
  
  <pre><code>import java.io.ByteArrayOutputStream;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.ParserConfigurationException;
  import javax.xml.transform.OutputKeys;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerException;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.dom.DOMSource;
  import javax.xml.transform.stream.StreamResult;
  
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
  public class MyTestClass {
  
      public static void main(String argv[]) {
  
        try {
          DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
  
          // root elements
          Document doc = docBuilder.newDocument();
          Element rootElement = doc.createElement("company");
          doc.appendChild(rootElement);
  
          // staff elements
          Element staff = doc.createElement("Staff");
          rootElement.appendChild(staff);
  
          // firstname elements
          Element firstname = doc.createElement("firstname");
          firstname.appendChild(doc.createTextNode("yong"));
          staff.appendChild(firstname);
  
          // lastname elements
          Element lastname = doc.createElement("lastname");
          lastname.appendChild(doc.createTextNode("mook kim"));
          staff.appendChild(lastname);
  
          // nickname elements
          Element nickname = doc.createElement("nickname");
          nickname.appendChild(doc.createTextNode("mkyong"));
          staff.appendChild(nickname);
  
          // salary elements
          Element salary = doc.createElement("salary");
          salary.appendChild(doc.createTextNode("100000"));
          staff.appendChild(salary);
  
          Transformer t = TransformerFactory.newInstance().newTransformer();
          ByteArrayOutputStream s = new ByteArrayOutputStream();
          t.setOutputProperty(OutputKeys.INDENT, "yes");
          t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
          t.transform(new DOMSource(doc),new StreamResult(s));
          System.out.println(new String(s.toByteArray()));
        } catch (ParserConfigurationException pce) {
          pce.printStackTrace();
        } catch (TransformerException tfe) {
          tfe.printStackTrace();
        }
      }
  }
  </code></pre>
  
  <p>It returns:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; 
   &lt;company&gt;  
    &lt;Staff&gt;
       &lt;firstname&gt;yong&lt;/firstname&gt;
       &lt;lastname&gt;mook kim&lt;/lastname&gt;
       &lt;nickname&gt;mkyong&lt;/nickname&gt;
       &lt;salary&gt;100000&lt;/salary&gt;   
    &lt;/Staff&gt; 
   &lt;/company&gt;
  </code></pre>
  
  <p>Is any way to delete or modify this node <code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;</code> ?</p>