Using the following simple code:
package test; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class TestOutput
To make the output a valid XML document, NO. A valid XML document must start with a processing instruction. See the XML specification http://www.w3.org/TR/REC-xml/#sec-prolog-dtd for more details.