Class Xhtml5Parser

All Implemented Interfaces:
LogEnabled, HtmlMarkup, Markup, XmlMarkup, Xhtml5Markup, Parser

@Component(role=Parser.class, hint="xhtml5") public class Xhtml5Parser extends Xhtml5BaseParser implements Xhtml5Markup
Parse an xhtml model and emit events into a Doxia Sink.
  • Field Details

    • ROLE_HINT

      public static final String ROLE_HINT
      The role hint for the Xhtml5Parser Plexus component.
      See Also:
    • boxed

      private boolean boxed
      For boxed verbatim.
    • isEmptyElement

      private boolean isEmptyElement
      Empty elements don't write a closing tag.
    • sourceContent

      private String sourceContent
      The source content of the input reader. Used to pass into macros.
  • Constructor Details

    • Xhtml5Parser

      public Xhtml5Parser()
  • Method Details

    • handleStartTag

      protected void handleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, MacroExecutionException
      Goes through the possible start tags. Just calls Xhtml5BaseParser.baseStartTag(XmlPullParser,Sink), this should be overridden by implementing parsers to include additional tags.
      Overrides:
      handleStartTag in class Xhtml5BaseParser
      Parameters:
      parser - A parser, not null.
      sink - the sink to receive the events.
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
      MacroExecutionException - if there's a problem executing a macro
    • handleEndTag

      protected void handleEndTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, MacroExecutionException
      Goes through the possible end tags. Just calls Xhtml5BaseParser.baseEndTag(XmlPullParser,Sink), this should be overridden by implementing parsers to include additional tags.
      Overrides:
      handleEndTag in class Xhtml5BaseParser
      Parameters:
      parser - A parser, not null.
      sink - the sink to receive the events.
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
      MacroExecutionException - if there's a problem executing a macro
    • handleComment

      protected void handleComment(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
      Handles comments.

      This is a default implementation, all data are emitted as comment events into the specified sink.

      Overrides:
      handleComment in class Xhtml5BaseParser
      Parameters:
      parser - A parser, not null.
      sink - the sink to receive the events. Not null.
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
    • processMacro

      private void processMacro(String text, Sink sink) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
      process macro embedded in XHTML commment
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException
    • escapeForMacro

      private String escapeForMacro(String s)
      escapeForMacro
      Parameters:
      s - String
      Returns:
      String
    • unescapeForMacro

      private String unescapeForMacro(String s)
      unescapeForMacro
      Parameters:
      s - String
      Returns:
      String
    • init

      protected void init()
      Initialize the parser. This is called first by AbstractParser.parse(java.io.Reader, org.apache.maven.doxia.sink.Sink) and can be used to set the parser into a clear state so it can be re-used.
      Overrides:
      init in class Xhtml5BaseParser
    • parse

      public void parse(Reader source, Sink sink, String reference) throws ParseException
      Parses the given source model and emits Doxia events into the given sink.
      Specified by:
      parse in interface Parser
      Overrides:
      parse in class Xhtml5BaseParser
      Parameters:
      source - not null reader that provides the source document. You could use newReader methods from ReaderFactory.
      sink - A sink that consumes the Doxia events.
      reference - the reference
      Throws:
      ParseException - if the model could not be parsed.