XML generated by xstream.toXml() is printing to one line

159 Views Asked by At

Can anyone tell me why when I open my .XML file generated by XStream.toXML().. The XML appears on ONE line. Yet when I cut and paste it here into this form it looks just like it should, nicely formatted.

I need the generated file to look just like the output printed to the console.

Any advice is greatly appreciated. I'm thinking it has something to do with encoding but I'm not sure how to set the encoding for my file output.

Thank you!

EDIT: I was able to get the text displaying correctly by running a replace on the string. "\n" for "\r\n"

The problem is I'm having trouble understanding how and why XStream doesn't do this for me?

0

There are 0 best solutions below