node.setDocType(createXHTMLDoctypeToken());
// write result to output
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer writer = new OutputStreamWriter(out, outputEncoding);
writer = new NoCloseWriter(writer);
EpublibXmlSerializer xmlSerializer = new EpublibXmlSerializer(htmlCleaner.getProperties(), outputEncoding);
xmlSerializer.write(node, writer, outputEncoding);
writer.flush();
return out.toByteArray();