The OutputFormat dictates what underlying serialized is used
to serialize the document based on the specified method. If the output
format or method are missing, the default is an XML serializer with
UTF-8 encoding and now indentation.

setOutputFormat

Specifies an output format for this serializer. It the
serializer has already been associated with an output format,
it will switch to the new format. This method should not be
called while the serializer is in the process of serializing
a document.