Use this type of MarshalRecord when the marshal target is a Writer and the XML should be formatted with carriage returns and indenting.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
FormattedWriterRecord formattedWriterRecord = new FormattedWriterRecord();
formattedWriterRecord.setWriter(myWriter);
xmlMarshaller.marshal(myObject, formattedWriterRecord);
If the marshal(Writer) and setFormattedOutput(true) method is called on XMLMarshaller, then the Writer is automatically wrapped in a FormattedWriterRecord.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
xmlMarshaller xmlMarshaller.setFormattedOutput(true);
xmlMarshaller.marshal(myObject, myWriter);
@see org.eclipse.persistence.oxm.XMLMarshaller