OutputFormat format = new OutputFormat();
format.setIndenting(true);
format.setIndent(1);
HTMLSerializer serializer = new HTMLSerializer(format);
serializer.setOutputByteStream(System.out);
serializer.serialize(doc);
}
catch (IOException e) {
System.err.println("error: Unable to output document.");
System.exit(1);
}