Class Xhtml5Sink

All Implemented Interfaces:
AutoCloseable, HtmlMarkup, Markup, XmlMarkup, Xhtml5Markup, Sink

public class Xhtml5Sink extends Xhtml5BaseSink implements Xhtml5Markup
XHTML 5.2 sink implementation.
  • Field Details

    • encoding

      private String encoding
    • languageId

      private String languageId
    • headTitleFlag

      private boolean headTitleFlag
      An indication on if we're inside a head title.
  • Constructor Details

    • Xhtml5Sink

      protected Xhtml5Sink(Writer writer)
      Constructor, initialize the Writer.
      Parameters:
      writer - not null writer to write the result.
    • Xhtml5Sink

      protected Xhtml5Sink(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.
    • Xhtml5Sink

      protected Xhtml5Sink(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.
  • Method Details

    • head

      public void head(SinkEventAttributes attributes)
      Description copied from class: SinkAdapter
      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.
    • head_

      public void head_()
      Ends the head element.
      Specified by:
      head_ in interface Sink
      Overrides:
      head_ in class SinkAdapter
    • title

      public void title(SinkEventAttributes attributes)
      Starts the title element. This is used to identify the document.

      Supported attributes are the base attributes.

      Specified by:
      title in interface Sink
      Overrides:
      title in class SinkAdapter
      Parameters:
      attributes - A set of SinkEventAttributes, may be null.
      See Also:
    • title_

      public void title_()
      Ends the title element.
      Specified by:
      title_ in interface Sink
      Overrides:
      title_ in class SinkAdapter
      See Also:
    • author_

      public void author_()
      Ends an author element.
      Specified by:
      author_ in interface Sink
      Overrides:
      author_ in class SinkAdapter
      See Also:
    • date_

      public void date_()
      Ends the date element.
      Specified by:
      date_ in interface Sink
      Overrides:
      date_ in class SinkAdapter
      See Also:
    • 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:
    • body_

      public void body_()
      Ends the body element.
      Specified by:
      body_ in interface Sink
      Overrides:
      body_ in class SinkAdapter
      See Also:
    • setHeadTitleFlag

      protected void setHeadTitleFlag(boolean headTitleFlag)

      Setter for the field headTitleFlag.

      Parameters:
      headTitleFlag - an header title flag.
      Since:
      1.1
    • isHeadTitleFlag

      protected boolean isHeadTitleFlag()

      isHeadTitleFlag.

      Returns:
      the current headTitleFlag.
      Since:
      1.1