OutlineItem root = parser.parse(textileSource);
StringWriter out = new StringWriter(8096);
XmlStreamWriter writer = createXmlStreamWriter(out);
writer.writeStartDocument("utf-8","1.0");
writer.writeStartElement("toc");
writer.writeAttribute("topic", getHtmlFile());
writer.writeAttribute("label", getBookTitle());
emitToc(writer,root.getChildren());
writer.writeEndElement(); // toc
writer.writeEndDocument();
writer.close();
return out.toString();
}