I'm using XStream to generate xml files of my objects. However, the version and encoding header is being omitted from the xml file, and I'm not sure why. Here is my method that prints out the xml file:
public static void personsToXML(ArrayList<Person> persons) throws FileNotFoundException {
PrintWriter pw = new PrintWriter(new File("someFilePath"));
XStream xstream = new XStream();
for (Person i : persons)
pw.print(xstream.toXML(i));
pw.close();
}
It outputs the xml just fine, but there is no header present, as in
<?xml version="1.0"?>
is not present.
Thanks!