Download Apache Maven Doxia - The Apache Software Foundation!
Transcript
16 Using the Sink API
/**
* Generate a simple document and emit it
* into the specified sink. The sink is flushed but not closed.
*
* @param sink The sink to receive the events.
*/
public static void generate( Sink sink )
{
sink.head();
sink.title();
sink.text( "Title" );
sink.title_();
sink.author();
sink.text( "Author" );
sink.author_();
sink.date();
sink.text( "Date" );
sink.date_();
sink.head_();
sink.body();
sink.paragraph();
sink.text( "A paragraph of text." );
sink.paragraph_();
sink.section1();
sink.sectionTitle1();
sink.text( "Section title" );
sink.sectionTitle1_();
sink.paragraph();
sink.text( "Paragraph in section." );
sink.paragraph_();
sink.section1_();
sink.body_();
sink.flush();
}
A more complete example that also shows the 'canonical' order of events to use when generating a
document, can be found in the Doxia SinkTestDocument class.
©2015, The Apache Software Foundation • ALL RIGHTS RESERVED.
47