public class XdocSink extends Xhtml5BaseSink implements XdocMarkup
contentStack, inlineStack, tableAttributes
AUTHOR_TAG, DATE_TAG, DOCUMENT_TAG, MACRO_TAG, PROPERTIES_TAG, SECTION_TAG, SOURCE_TAG, SUBSECTION_TAG, XDOC_NAMESPACE, XDOC_SYSTEM_ID
A, ABBR, ADDRESS, AREA, ARTICLE, ASIDE, AUDIO, B, BASE, BDI, BDO, BLOCKQUOTE, BODY, BR, BUTTON, CANVAS, CAPTION, CDATA_TYPE, CITE, CODE, COL, COLGROUP, COMMAND, DATA, DATALIST, DD, DEL, DETAILS, DFN, DIALOG, DIV, DL, DT, EM, EMBED, ENTITY_TYPE, FIELDSET, FIGCAPTION, FIGURE, FOOTER, FORM, H1, H2, H3, H4, H5, H6, HEAD, HEADER, HGROUP, HR, HTML, I, IFRAME, IMG, INPUT, INS, KBD, KEYGEN, LABEL, LEGEND, LI, LINK, MAIN, MAP, MARK, MENU, MENUITEM, META, METER, NAV, NOSCRIPT, OBJECT, OL, OPTGROUP, OPTION, OUTPUT, P, PARAM, PICTURE, PRE, PROGRESS, Q, RB, RP, RT, RTC, RUBY, S, SAMP, SCRIPT, SECTION, SELECT, SMALL, SOURCE, SPAN, STRONG, STYLE, SUB, SUMMARY, SUP, SVG, TABLE, TAG_TYPE_END, TAG_TYPE_SIMPLE, TAG_TYPE_START, TBODY, TD, TEMPLATE, TEXTAREA, TFOOT, TH, THEAD, TIME, TITLE, TR, TRACK, U, UL, VAR, VIDEO, WBR
BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE
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
JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5, SECTION_LEVEL_6
Modifier | Constructor and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
author_()
Ends an author element.
|
void |
body_()
Ends the body element.
|
void |
body(SinkEventAttributes attributes)
Starts the body of a document.
|
void |
close()
close.
|
void |
date_()
Ends the date element.
|
void |
head_()
Ends the head element.
|
void |
head(SinkEventAttributes attributes)
Starts the head element.
|
protected void |
init()
This is called in
AbstractSink.head() or in Sink.close() , and can be used
to set the sink into a clear state so it can be re-used. |
protected void |
onSection_(int depth)
Ends a section.
|
protected void |
onSection(int depth,
SinkEventAttributes attributes)
Starts a section.
|
protected void |
onSectionTitle_(int depth)
Ends a section title.
|
protected void |
onSectionTitle(int depth,
SinkEventAttributes attributes)
Starts a section title.
|
void |
tableRow(SinkEventAttributes attributes)
Rows are striped with two colors by adding the class
a or b . |
void |
tableRows(int[] justification,
boolean grid)
The default style class is
bodyTable . |
void |
title_()
Ends the title element.
|
void |
title(SinkEventAttributes attributes)
Starts the title element.
|
void |
verbatim_()
Ends a verbatim element.
|
void |
verbatim(SinkEventAttributes attributes)
The default class style is
verbatim , for source is verbatim source . |
address_, address, anchor_, anchor, article_, article, blockquote_, blockquote, bold_, bold, comment, content_, content, content, data_, data, definedTerm_, definedTerm, definition_, definition, definitionList_, definitionList, division_, division, encodeURL, escapeHTML, figure_, figure, figureCaption_, figureCaption, figureGraphics, flush, footer_, footer, getCellCount, getCellJustif, getTextBuffer, header_, header, horizontalRule, inline_, inline, isHeadFlag, isVerbatimFlag, italic_, italic, lineBreak, lineBreakOpportunity, link_, link, list_, list, listItem_, listItem, monospaced_, monospaced, navigation_, navigation, nonBreakingSpace, numberedList_, numberedList, numberedListItem_, numberedListItem, pageBreak, paragraph_, paragraph, rawText, resetTextBuffer, section_, section, sectionTitle_, sectionTitle, setCellCount, setCellJustif, setHeadFlag, setVerbatimFlag, sidebar_, sidebar, table_, table, tableCaption_, tableCaption, tableCell_, tableCell, tableHeaderCell_, tableHeaderCell, tableRow_, tableRows_, text, time_, time, unknown, verbatimContent, write, writeEndTag, writeStartTag
getNameSpace, setInsertNewline, setNameSpace, writeEOL, writeSimpleTag, writeSimpleTag, writeStartTag, writeStartTag
author, date, definitionListItem_, definitionListItem
address, anchor, article, author, blockquote, body, content, data, date, definedTerm, definition, definitionList, definitionListItem, division, figure, figureCaption, figureGraphics, footer, head, header, horizontalRule, inline, lineBreak, lineBreakOpportunity, link, list, listItem, navigation, numberedList, numberedListItem, paragraph, section1_, section1, section2_, section2, section3_, section3, section4_, section4, section5_, section5, section6_, section6, sectionTitle_, sectionTitle, sectionTitle1_, sectionTitle1, sectionTitle2_, sectionTitle2, sectionTitle3_, sectionTitle3, sectionTitle4_, sectionTitle4, sectionTitle5_, sectionTitle5, sectionTitle6_, sectionTitle6, sidebar, table, tableCaption, tableCell, tableHeaderCell, tableRow, tableRows, text, time, title, unifyEOLs, verbatim
protected XdocSink(Writer writer)
writer
- not null writer to write the result. Should be an UTF-8 Writer.
You could use newXmlWriter
methods from WriterFactory
.protected XdocSink(Writer writer, String encoding)
writer
- not null writer to write the result.encoding
- the encoding used, that should be written to the generated HTML content
if not null
.protected XdocSink(Writer writer, String encoding, String languageId)
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.protected void init()
AbstractSink.head()
or in Sink.close()
, and can be used
to set the sink into a clear state so it can be re-used.init
in class Xhtml5BaseSink
public void head(SinkEventAttributes attributes)
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
.
head
in interface Sink
head
in class SinkAdapter
attributes
- A set of SinkEventAttributes
, may be null
.XdocMarkup.DOCUMENT_TAG
,
XdocMarkup.PROPERTIES_TAG
public void head_()
head_
in interface Sink
head_
in class SinkAdapter
XdocMarkup.DOCUMENT_TAG
,
XdocMarkup.PROPERTIES_TAG
public void title(SinkEventAttributes attributes)
Supported attributes are the base attributes
.
title
in interface Sink
title
in class SinkAdapter
attributes
- A set of SinkEventAttributes
, may be null
.HTML.Tag.TITLE
public void title_()
title_
in interface Sink
title_
in class SinkAdapter
HTML.Tag.TITLE
public void author_()
author_
in interface Sink
author_
in class SinkAdapter
XdocMarkup.AUTHOR_TAG
public void date_()
date_
in interface Sink
date_
in class SinkAdapter
XdocMarkup.DATE_TAG
public void body(SinkEventAttributes attributes)
Supported attributes are the base attributes
.
body
in interface Sink
body
in class SinkAdapter
attributes
- A set of SinkEventAttributes
, may be null
.HTML.Tag.BODY
public void body_()
body_
in interface Sink
body_
in class SinkAdapter
HTML.Tag.BODY
,
XdocMarkup.DOCUMENT_TAG
protected void onSection(int depth, SinkEventAttributes attributes)
onSection
in class Xhtml5BaseSink
depth
- The level of the section.attributes
- some attributes. May be null.XdocMarkup.SECTION_TAG
,
XdocMarkup.SUBSECTION_TAG
protected void onSection_(int depth)
onSection_
in class Xhtml5BaseSink
depth
- The level of the section.XdocMarkup.SECTION_TAG
,
XdocMarkup.SUBSECTION_TAG
protected void onSectionTitle(int depth, SinkEventAttributes attributes)
onSectionTitle
in class Xhtml5BaseSink
depth
- The level of the section title.attributes
- some attributes. May be null.HtmlMarkup.H3
,
HtmlMarkup.H4
,
HtmlMarkup.H5
,
HtmlMarkup.H6
protected void onSectionTitle_(int depth)
onSectionTitle_
in class Xhtml5BaseSink
depth
- The level of the section title.HtmlMarkup.H3
,
HtmlMarkup.H4
,
HtmlMarkup.H5
,
HtmlMarkup.H6
public void verbatim(SinkEventAttributes attributes)
verbatim
, for source is verbatim 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
(values: "source"),ALIGN
,WIDTH
.
verbatim
in interface Sink
verbatim
in class Xhtml5BaseSink
attributes
- a SinkEventAttributes
object.XdocMarkup.SOURCE_TAG
,
HTML.Tag.PRE
public void verbatim_()
verbatim_
in interface Sink
verbatim_
in class Xhtml5BaseSink
XdocMarkup.SOURCE_TAG
,
HTML.Tag.PRE
public void tableRows(int[] justification, boolean grid)
bodyTable
.tableRows
in interface Sink
tableRows
in class Xhtml5BaseSink
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
- if true
the style class bodyTableBorder
will be added
true to provide a grid, false otherwise.HTML.Tag.TABLE
public void tableRow(SinkEventAttributes attributes)
a
or b
. If the provided attributes
specify the hidden
class, the next call to tableRow will set the same striping class as this one. A
style for hidden
or table.bodyTable hidden
may need to be provided to actually hide
such a row. Starts a table row.
Supported attributes are the base attributes
plus:
ALIGN
,BGCOLOR
,VALIGN
.
tableRow
in interface Sink
tableRow
in class Xhtml5BaseSink
attributes
- A set of SinkEventAttributes
, may be null
.HTML.Tag.TR
public void close()
close.
close
in interface AutoCloseable
close
in interface Sink
close
in class Xhtml5BaseSink
Copyright © 2005–2024 The Apache Software Foundation. All rights reserved.