Package org.apache.maven.doxia.sink
The Doxia API is based on
Sink objects: each Sink consumes Doxia events to produce a resultant output format (in most cases XHTML).
Consumers just create a Sink object from the SinkFactory for the desired format and call its methods.
Providers implement the Sink and SinkFactory interface to write the desired output.
Those need to leverage JSR 330 annotations to be discoverable by the Eclipse Sisu container.
Consumers can then inject the desired SinkFactory using the @Inject and @Named annotation with the name of the format (e.g. "xhtml", "fml", "markdown", etc.).
Using Maven Doxia Sink API (without a parser)
File userDir = new File( System.getProperty ( "user.dir" ) );
File outputFile = new File( userDir, "test.html" );
@Inject @Named("driver")
SinkFactory sinkFactory;
try (Sink sink = sinkFactory.createSink(outputFile.getParentFile(), outputFile.getName())) {
// Sink head
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 head
sink.body();
sink.paragraph();
sink.text("Paragraph 1, line 1.");
sink.paragraph_();
...
sink.body_();
}
Alternatively one can populate a Sink through a org.apache.maven.doxia.parser.Parser or the org.apache.maven.doxia.Doxia interface, which is a high-level API to ease using a parser.-
Interface Summary Interface Description Locator Interface for associating aSinkevent with a document location.Sink A Sink consumes Doxia events to produce a resultant output format (in most cases XHTML).SinkEventAttributes A set of attributes for a sink event.SinkFactory A factory that creates aSinkobject. -
Class Summary Class Description EmptyLocator ALocatorimplementation that does not provide any information.