Class XdocsTemplateParser

  • All Implemented Interfaces:
    org.apache.maven.doxia.logging.LogEnabled, org.apache.maven.doxia.markup.HtmlMarkup, org.apache.maven.doxia.markup.Markup, org.apache.maven.doxia.markup.XmlMarkup, org.apache.maven.doxia.module.xdoc.XdocMarkup, org.apache.maven.doxia.parser.Parser

    @Component(role=org.apache.maven.doxia.parser.Parser.class,
               hint="xdocs-template")
    public class XdocsTemplateParser
    extends org.apache.maven.doxia.module.xdoc.XdocParser
    Parser for Checkstyle's xdoc templates. This parser is responsible for generating xdocs(.xml) from the xdoc templates(.xml.template). The templates are regular xdocs with custom macros for generating dynamic content - properties, examples, etc. This parser behaves just like the XdocParser with the difference that all elements apart from the macro element are copied as is to the output. This module will be removed once #13426 is resolved.
    See Also:
    ExampleMacro
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.maven.doxia.parser.AbstractXmlParser

        org.apache.maven.doxia.parser.AbstractXmlParser.CachedFileEntityResolver
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private String macroName
      A macro name.
      private Map<String,​Object> macroParameters
      The macro parameters.
      private String sourceContent
      The source content of the input reader.
      static String TEMP_DIR
      User working directory.
      • Fields inherited from interface org.apache.maven.doxia.markup.HtmlMarkup

        A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, ARTICLE, ASIDE, AUDIO, B, BASE, BASEFONT, BDI, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CANVAS, CAPTION, CDATA_TYPE, CENTER, CITE, CODE, COL, COLGROUP, COMMAND, DATA, DATALIST, DD, DEL, DETAILS, DFN, DIALOG, DIR, DIV, DL, DT, EM, EMBED, ENTITY_TYPE, FIELDSET, FIGCAPTION, FIGURE, FONT, FOOTER, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HEADER, HGROUP, HR, HTML, I, IFRAME, IMG, INPUT, INS, ISINDEX, KBD, KEYGEN, LABEL, LEGEND, LI, LINK, MAIN, MAP, MARK, MENU, META, METER, NAV, NOFRAMES, 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, STRIKE, STRONG, STYLE, SUB, SUMMARY, SUP, TABLE, TAG_TYPE_END, TAG_TYPE_SIMPLE, TAG_TYPE_START, TBODY, TD, TEMPLATE, TEXTAREA, TFOOT, TH, THEAD, TIME, TITLE, TR, TRACK, TT, U, UL, VAR, VIDEO, WBR
      • 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.parser.Parser

        ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
      • 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.XmlMarkup

        BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void handleEndTag​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink)  
      protected void handleStartTag​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink)  
      void parse​(Reader source, org.apache.maven.doxia.sink.Sink sink, String reference)  
      private void processMacroEnd​(org.apache.maven.doxia.sink.Sink sink)
      Execute a macro.
      private void processMacroStart​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
      Handle the opening tag of a macro.
      private void processParamStart​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink)
      Handle the opening tag of a parameter.
      private void reinitializeMacroFields()
      Reinitialize the macro fields.
      • Methods inherited from class org.apache.maven.doxia.module.xdoc.XdocParser

        consecutiveSections, init
      • Methods inherited from class org.apache.maven.doxia.parser.XhtmlBaseParser

        baseEndTag, baseStartTag, getSectionLevel, handleCdsect, handleComment, handleText, initXmlParser, isScriptBlock, isVerbatim, setSectionLevel, validAnchor, verbatim, verbatim_
      • Methods inherited from class org.apache.maven.doxia.parser.AbstractXmlParser

        getAddDefaultEntities, getAttributesFromParser, getLocalEntities, getText, getType, handleEntity, handleUnknown, isCollapsibleWhitespace, isIgnorableWhitespace, isTrimmableWhitespace, isValidate, setAddDefaultEntities, setCollapsibleWhitespace, setIgnorableWhitespace, setTrimmableWhitespace, setValidate
      • Methods inherited from class org.apache.maven.doxia.parser.AbstractParser

        doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, isEmitComments, isSecondParsing, parse, parse, parse, setEmitComments, setSecondParsing
    • Method Detail

      • parse

        public void parse​(Reader source,
                          org.apache.maven.doxia.sink.Sink sink,
                          String reference)
                   throws org.apache.maven.doxia.parser.ParseException
        Specified by:
        parse in interface org.apache.maven.doxia.parser.Parser
        Overrides:
        parse in class org.apache.maven.doxia.module.xdoc.XdocParser
        Throws:
        org.apache.maven.doxia.parser.ParseException
      • handleStartTag

        protected void handleStartTag​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                      org.apache.maven.doxia.sink.Sink sink)
                               throws org.apache.maven.doxia.macro.MacroExecutionException
        Overrides:
        handleStartTag in class org.apache.maven.doxia.module.xdoc.XdocParser
        Throws:
        org.apache.maven.doxia.macro.MacroExecutionException
      • handleEndTag

        protected void handleEndTag​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                    org.apache.maven.doxia.sink.Sink sink)
                             throws org.apache.maven.doxia.macro.MacroExecutionException
        Overrides:
        handleEndTag in class org.apache.maven.doxia.module.xdoc.XdocParser
        Throws:
        org.apache.maven.doxia.macro.MacroExecutionException
      • processMacroStart

        private void processMacroStart​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
                                throws org.apache.maven.doxia.macro.MacroExecutionException
        Handle the opening tag of a macro. Gather the macro name and parameters.
        Parameters:
        parser - the xml parser.
        Throws:
        org.apache.maven.doxia.macro.MacroExecutionException - if the macro name is not specified.
      • processParamStart

        private void processParamStart​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                       org.apache.maven.doxia.sink.Sink sink)
                                throws org.apache.maven.doxia.macro.MacroExecutionException
        Handle the opening tag of a parameter. Gather the parameter name and value.
        Parameters:
        parser - the xml parser.
        sink - the sink object.
        Throws:
        org.apache.maven.doxia.macro.MacroExecutionException - if the parameter name or value is not specified.
      • processMacroEnd

        private void processMacroEnd​(org.apache.maven.doxia.sink.Sink sink)
                              throws org.apache.maven.doxia.macro.MacroExecutionException
        Execute a macro. Creates a MacroRequest with the gathered macroName and macroParameters and executes the macro. Afterward, the macro fields are reinitialized.
        Parameters:
        sink - the sink object.
        Throws:
        org.apache.maven.doxia.macro.MacroExecutionException - if a macro is not found.