I have the following (old) code:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLSerializer output = new XMLSerializer(baos, new OutputFormat(document));
output.serialize(document);
bytes = baos.toByteArray();
I want to update the code above so that it no longer includes deprecated code. I had a look at LSOuput as a replacement but I'm not really sure how to go about it.