Class Xhtml5Parser

    • Field Detail

      • boxed

        private boolean boxed
        For boxed verbatim.
      • isEmptyElement

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

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

      • Xhtml5Parser

        public Xhtml5Parser()
    • Method Detail

      • 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​(java.lang.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 java.lang.String escapeForMacro​(java.lang.String s)
        escapeForMacro
        Parameters:
        s - String
        Returns:
        String
      • unescapeForMacro

        private java.lang.String unescapeForMacro​(java.lang.String s)
        unescapeForMacro
        Parameters:
        s - String
        Returns:
        String
      • parse

        public void parse​(java.io.Reader source,
                          Sink sink)
                   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.
        Throws:
        ParseException - if the model could not be parsed.