* document to be prettified
* @param output
* stream to which output is written
*/
protected void prettyPrint(Document document, OutputStream output) {
OutputFormat format = new OutputFormat(document);
// setIndenting must be first as it resets indent and line width
format.setIndenting(true);
format.setIndent(4);
format.setLineWidth(200);
XMLSerializer serializer = new XMLSerializer(output, format);
try {
serializer.serialize(document);
} catch (IOException e) {
throw new RuntimeException(e);