org.apache.maven.doxia.module.xdoc
Class XdocSink

java.lang.Object
  extended by org.apache.maven.doxia.sink.AbstractSink
      extended by org.apache.maven.doxia.sink.SinkAdapter
          extended by org.apache.maven.doxia.sink.AbstractXmlSink
              extended by org.apache.maven.doxia.sink.XhtmlBaseSink
                  extended by org.apache.maven.doxia.module.xdoc.XdocSink
All Implemented Interfaces:
LogEnabled, HtmlMarkup, Markup, XmlMarkup, XdocMarkup, Sink
Direct Known Subclasses:
XmlWriterXdocSink

public class XdocSink
extends XhtmlBaseSink
implements XdocMarkup

Xdoc Sink implementation.
It uses the Xdoc XSD http://maven.apache.org/xsd/xdoc-2.0.xsd.

Since:
1.0
Version:
$Id: XdocSink.java 926772 2010-03-23 20:52:37Z ltheussl $
Author:
James Taylor

Field Summary
 
Fields inherited from class org.apache.maven.doxia.sink.XhtmlBaseSink
tableAttributes, tableRows
 
Fields inherited from interface org.apache.maven.doxia.module.xdoc.XdocMarkup
AUTHOR_TAG, DATE_TAG, DOCUMENT_TAG, MACRO_TAG, PROPERTIES_TAG, SECTION_TAG, SOURCE_TAG, SUBSECTION_TAG, XDOC_NAMESPACE, XDOC_SYSTEM_ID
 
Fields inherited from interface org.apache.maven.doxia.markup.HtmlMarkup
A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CDATA_TYPE, CENTER, CITE, CODE, COL, COLGROUP, DD, DEL, DFN, DIR, DIV, DL, DT, EM, ENTITY_TYPE, FIELDSET, FONT, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML, I, IFRAME, IMG, INPUT, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, MAP, MENU, META, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTGROUP, OPTION, P, PARAM, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB, SUP, TABLE, TAG_TYPE_END, TAG_TYPE_SIMPLE, TAG_TYPE_START, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR
 
Fields inherited from interface org.apache.maven.doxia.markup.XmlMarkup
BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE
 
Fields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STAR
 
Fields inherited from interface org.apache.maven.doxia.sink.Sink
JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, ROLE, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5
 
Constructor Summary
protected XdocSink(Writer writer)
          Constructor, initialize the Writer.
protected XdocSink(Writer writer, String encoding)
          Constructor, initialize the Writer and tells which encoding is used.
protected XdocSink(Writer writer, String encoding, String languageId)
          Constructor, initialize the Writer and tells which encoding and languageId are used.
 
Method Summary
 void author_()
          Ends an author element.
 void body_()
          Ends the body element.
 void body()
          Starts the body of a document.
 void body(SinkEventAttributes attributes)
          Starts the body of a document. This contains the document's content.

Supported attributes are the base attributes.

 void close()
          Close the writer or the stream, if needed. Closing a previously-closed Sink has no effect.
 void date_()
          Ends the date element.
 void head_()
          Ends the head element.
 void head()
          Starts the head element.
 void head(SinkEventAttributes attributes)
          Starts the head element.

This contains information about the current document, (eg its title) that is not considered document content. The head element is optional but if it exists, it has to be unique within a sequence of Sink events that produces one output document, and it has to come before the Sink.body(SinkEventAttributes) element.

The canonical sequence of events for the head element is:

   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_();
 

but none of the enclosed events is required. However, if they exist they have to occur in the order shown, and the title() and date() events have to be unique (author() events may occur any number of times).

Supported attributes are:

PROFILE, LANG.
protected  void init()
          This is called in Sink.head() or in Sink.close(), and can be used to set the sink into a clear state so it can be re-used.
 void link(String name, String target)
          Adds a link with an optional target.
protected  void markup(String text)
          Deprecated. use write(String)
protected  void onSection_(int depth)
          Ends a section. Ends a section.
protected  void onSection(int depth, SinkEventAttributes attributes)
          Starts a section. Starts a section.
protected  void onSectionTitle_(int depth)
          Ends a section title. Ends a section title.
protected  void onSectionTitle(int depth, SinkEventAttributes attributes)
          Starts a section title. Starts a section title.
 void tableRow()
          The default valign is top.
 void tableRows(int[] justification, boolean grid)
          The default align is center.
 void title_()
          Ends the title element.
 void title()
          Starts the title element.
 void verbatim_()
          Ends a verbatim element.
 void verbatim(SinkEventAttributes attributes)
          The default class style for boxed is source.
 
Methods inherited from class org.apache.maven.doxia.sink.XhtmlBaseSink
anchor_, anchor, anchor, bold_, bold, comment, content, definedTerm_, definedTerm, definedTerm, definition_, definition, definition, definitionList_, definitionList, definitionList, encodeURL, escapeHTML, figure_, figure, figure, figureCaption_, figureCaption, figureCaption, figureGraphics, figureGraphics, flush, getCellCount, getCellJustif, getTextBuffer, horizontalRule, horizontalRule, isHeadFlag, isVerbatimFlag, italic_, italic, lineBreak, lineBreak, link_, link, link, list_, list, list, listItem_, listItem, listItem, monospaced_, monospaced, nonBreakingSpace, numberedList_, numberedList, numberedList, numberedListItem_, numberedListItem, numberedListItem, pageBreak, paragraph_, paragraph, paragraph, rawText, resetState, resetTextBuffer, section_, section, section1_, section1, section2_, section2, section3_, section3, section4_, section4, section5_, section5, sectionTitle_, sectionTitle, sectionTitle1_, sectionTitle1, sectionTitle2_, sectionTitle2, sectionTitle3_, sectionTitle3, sectionTitle4_, sectionTitle4, sectionTitle5_, sectionTitle5, setCellCount, setCellJustif, setHeadFlag, setVerbatimFlag, table_, table, table, tableCaption_, tableCaption, tableCaption, tableCell_, tableCell, tableCell, tableCell, tableHeaderCell_, tableHeaderCell, tableHeaderCell, tableHeaderCell, tableRow_, tableRow, tableRows_, text, text, unknown, verbatim, verbatimContent, write, writeEndTag, writeStartTag
 
Methods inherited from class org.apache.maven.doxia.sink.AbstractXmlSink
getNameSpace, setNameSpace, writeEOL, writeSimpleTag, writeSimpleTag, writeStartTag, writeStartTag
 
Methods inherited from class org.apache.maven.doxia.sink.SinkAdapter
author, author, date, date, definitionListItem_, definitionListItem, definitionListItem, sectionTitle_, sectionTitle, title
 
Methods inherited from class org.apache.maven.doxia.sink.AbstractSink
enableLogging, getLog, unifyEOLs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XdocSink

protected XdocSink(Writer writer)
Constructor, initialize the Writer.

Parameters:
writer - not null writer to write the result. Should be an UTF-8 Writer. You could use newXmlWriter methods from WriterFactory.

XdocSink

protected XdocSink(Writer writer,
                   String encoding)
Constructor, initialize the Writer and tells which encoding is used.

Parameters:
writer - not null writer to write the result.
encoding - the encoding used, that should be written to the generated HTML content if not null.
Since:
1.1

XdocSink

protected XdocSink(Writer writer,
                   String encoding,
                   String languageId)
Constructor, initialize the Writer and tells which encoding and languageId are used.

Parameters:
writer - not null writer to write the result.
encoding - the encoding used, that should be written to the generated HTML content if not null.
languageId - language identifier for the root element as defined by IETF BCP 47, Tags for the Identification of Languages; in addition, the empty string may be specified.
Since:
1.1
Method Detail

init

protected void init()
This is called in Sink.head() or in Sink.close(), and can be used to set the sink into a clear state so it can be re-used.

Overrides:
init in class XhtmlBaseSink

head

public void head()
Starts the head element.

Specified by:
head in interface Sink
Overrides:
head in class SinkAdapter
See Also:
head(org.apache.maven.doxia.sink.SinkEventAttributes)

head

public void head(SinkEventAttributes attributes)
Starts the head element.

This contains information about the current document, (eg its title) that is not considered document content. The head element is optional but if it exists, it has to be unique within a sequence of Sink events that produces one output document, and it has to come before the Sink.body(SinkEventAttributes) element.

The canonical sequence of events for the head element is:

   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_();
 

but none of the enclosed events is required. However, if they exist they have to occur in the order shown, and the title() and date() events have to be unique (author() events may occur any number of times).

Supported attributes are:

PROFILE, LANG.

Specified by:
head in interface Sink
Overrides:
head in class SinkAdapter
Parameters:
attributes - A set of SinkEventAttributes, may be null.
See Also:
XdocMarkup.DOCUMENT_TAG, XdocMarkup.PROPERTIES_TAG

head_

public void head_()
Ends the head element.

Specified by:
head_ in interface Sink
Overrides:
head_ in class SinkAdapter
See Also:
XdocMarkup.DOCUMENT_TAG, XdocMarkup.PROPERTIES_TAG

title

public void title()
Starts the title element.

Specified by:
title in interface Sink
Overrides:
title in class SinkAdapter
See Also:
HTML.Tag.TITLE

title_

public void title_()
Ends the title element.

Specified by:
title_ in interface Sink
Overrides:
title_ in class SinkAdapter
See Also:
HTML.Tag.TITLE

author_

public void author_()
Ends an author element.

Specified by:
author_ in interface Sink
Overrides:
author_ in class SinkAdapter
See Also:
XdocMarkup.AUTHOR_TAG

date_

public void date_()
Ends the date element.

Specified by:
date_ in interface Sink
Overrides:
date_ in class SinkAdapter
See Also:
XdocMarkup.DATE_TAG

body

public void body()
Starts the body of a document.

Specified by:
body in interface Sink
Overrides:
body in class SinkAdapter
See Also:
body(org.apache.maven.doxia.sink.SinkEventAttributes)

body

public void body(SinkEventAttributes attributes)
Starts the body of a document. This contains the document's content.

Supported attributes are the base attributes.

Specified by:
body in interface Sink
Overrides:
body in class SinkAdapter
Parameters:
attributes - A set of SinkEventAttributes, may be null.
See Also:
HTML.Tag.BODY

body_

public void body_()
Ends the body element.

Specified by:
body_ in interface Sink
Overrides:
body_ in class SinkAdapter
See Also:
HTML.Tag.BODY, XdocMarkup.DOCUMENT_TAG

onSection

protected void onSection(int depth,
                         SinkEventAttributes attributes)
Starts a section. The default class style is section. Starts a section.

Overrides:
onSection in class XhtmlBaseSink
Parameters:
depth - The level of the section.
attributes - some attributes. May be null.
See Also:
XdocMarkup.SECTION_TAG, XdocMarkup.SUBSECTION_TAG

onSection_

protected void onSection_(int depth)
Ends a section. Ends a section.

Overrides:
onSection_ in class XhtmlBaseSink
Parameters:
depth - The level of the section.
See Also:
XdocMarkup.SECTION_TAG, XdocMarkup.SUBSECTION_TAG

onSectionTitle

protected void onSectionTitle(int depth,
                              SinkEventAttributes attributes)
Starts a section title. Starts a section title.

Overrides:
onSectionTitle in class XhtmlBaseSink
Parameters:
depth - The level of the section title.
attributes - some attributes. May be null.
See Also:
HTML.Tag.H4, HTML.Tag.H5, HTML.Tag.H6

onSectionTitle_

protected void onSectionTitle_(int depth)
Ends a section title. Ends a section title.

Overrides:
onSectionTitle_ in class XhtmlBaseSink
Parameters:
depth - The level of the section title.
See Also:
HTML.Tag.H4, HTML.Tag.H5, HTML.Tag.H6

verbatim

public void verbatim(SinkEventAttributes attributes)
The default class style for boxed is source. Starts a verbatim block, ie a block where whitespace has semantic relevance.

Text in a verbatim block must only be wrapped at the linebreaks in the source, and spaces should not be collapsed. It should be displayed in a fixed-width font to retain the formatting but the overall size may be chosen by the implementation.

Most Sink events may be emitted within a verbatim block, the only elements explicitly forbidden are font-changing events and figures. Also, verbatim blocks may not be nested.

Supported attributes are the base attributes plus:

DECORATION (value: "boxed"), ALIGN, WIDTH.

Specified by:
verbatim in interface Sink
Overrides:
verbatim in class XhtmlBaseSink
Parameters:
attributes - A set of SinkEventAttributes, may be null.
See Also:
XdocMarkup.SOURCE_TAG, HTML.Tag.PRE

verbatim_

public void verbatim_()
Ends a verbatim element.

Specified by:
verbatim_ in interface Sink
Overrides:
verbatim_ in class XhtmlBaseSink
See Also:
XdocMarkup.SOURCE_TAG, HTML.Tag.PRE

tableRows

public void tableRows(int[] justification,
                      boolean grid)
The default align is center. The default class style is bodyTable. The default align is center. Starts an element that contains rows of table data.

Specified by:
tableRows in interface Sink
Overrides:
tableRows in class XhtmlBaseSink
Parameters:
justification - the default justification of columns. This can be overridden by individual table rows or table cells. If null a left alignment is assumed by default. If this array has less elements than there are columns in the table then the value of the last array element will be taken as default for the remaining table cells.
grid - true to provide a grid, false otherwise.
See Also:
HTML.Tag.TABLE

tableRow

public void tableRow()
The default valign is top. The default class style is a or b depending the row id. Starts a row element which acts as a container for a row of table cells.

Specified by:
tableRow in interface Sink
Overrides:
tableRow in class XhtmlBaseSink
See Also:
HTML.Tag.TR

close

public void close()
Description copied from class: XhtmlBaseSink
Close the writer or the stream, if needed. Closing a previously-closed Sink has no effect.

Specified by:
close in interface Sink
Overrides:
close in class XhtmlBaseSink

link

public void link(String name,
                 String target)
Adds a link with an optional target.

Parameters:
name - the link name.
target - the link target, may be null.

markup

protected void markup(String text)
Deprecated. use write(String)

Write text to output, preserving white space.

Parameters:
text - The text to write.


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.