writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(docbookOutputFile)),"utf-8");
} catch (Exception e) {
throw new BuildException(String.format("Cannot write to file '%s': %s",docbookOutputFile,e.getMessage()),e);
}
try {
DocBookDocumentBuilder builder = new DocBookDocumentBuilder(writer) {
@Override
protected XmlStreamWriter createXmlStreamWriter(Writer out) {
return super.createFormattingXmlStreamWriter(out);
}
};
MarkupParser parser = new MarkupParser();
parser.setDialect(new TextileDialect());
parser.setBuilder(builder);
builder.setBookTitle(bookTitle==null?name:bookTitle);
if (doctype != null) {
builder.setDoctype(doctype);
}
parser.parse(textile);
} finally {
try {
writer.close();