// we need to get the maximum line length in chars so we can give
// it to the writer
int maximumLineLength = getMaximumLineLength();
XMLDTDBuilder builder = new XMLDTDBuilder();
builder.setMaximumLineLength(maximumLineLength);
DTD dtd = builder.buildDTD();
DocumentOutputter outputter = new DOMDocumentOutputter(
dtd.createDocumentWriter(writer), getCharacterEncoder());
outputter.output(outputBuffer.getRoot());