Class DocBookParser

    • Field Detail

      • level

        private int level
        Level counter for calculating the section level.
      • isBold

        private boolean isBold
        Used to distinguish italic from bold.
      • inHead

        private boolean inHead
      • ignore

        private boolean ignore
      • simpleTag

        private boolean simpleTag
      • trademark

        private char trademark
      • parent

        private final java.util.Stack<java.lang.String> parent
        A selective stack of parent elements
      • HIER_ELEMENTS

        private static final java.util.Collection<java.lang.String> HIER_ELEMENTS
        The list of DocBook elements that introduce a new level of hierarchy.
      • META_ELEMENTS

        private static final java.util.Collection<java.lang.String> META_ELEMENTS
        Simplified DocBook elements that are direct children of <article> and that should be emitted into the Sink's head.
      • ARTICLEINFO_ELEMENTS

        private static final java.util.Collection<java.lang.String> ARTICLEINFO_ELEMENTS
        Simplified DocBook elements that occur within <articleinfo> and that are currently recognized by the parser.
      • VERBATIM_ELEMENTS

        private static final java.util.Collection<java.lang.String> VERBATIM_ELEMENTS
        The list of DocBook elements that will be rendered verbatim
      • BOLD_ELEMENTS

        private static final java.util.Collection<java.lang.String> BOLD_ELEMENTS
        The list of DocBook elements that will be rendered inline and bold
      • ITALIC_ELEMENTS

        private static final java.util.Collection<java.lang.String> ITALIC_ELEMENTS
        The list of DocBook elements that will be rendered inline and italic
      • MONOSPACE_ELEMENTS

        private static final java.util.Collection<java.lang.String> MONOSPACE_ELEMENTS
        The list of DocBook elements that will be rendered inline and monospace
      • IGNORABLE_ELEMENTS

        private static final java.util.Collection<java.lang.String> IGNORABLE_ELEMENTS
        The list of DocBook elements that may be ignored, either because they don't require any special processing or because they are not yet implemented.
    • Constructor Detail

      • DocBookParser

        public DocBookParser()
    • 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.
        Specified by:
        handleStartTag in class AbstractXmlParser
        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.
        Specified by:
        handleEndTag in class AbstractXmlParser
        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 AbstractXmlParser
        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
      • handleCdsect

        protected void handleCdsect​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                    Sink sink)
                             throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Handles CDATA sections.

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

        Overrides:
        handleCdsect in class AbstractXmlParser
        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
      • handleEntity

        protected void handleEntity​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                    Sink sink)
                             throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Handles entities.

        This is a default implementation, all entities are resolved and emitted as text events into the specified sink, except:

        • the entities with names #160, nbsp and #x00A0 are emitted as nonBreakingSpace() events.
        Overrides:
        handleEntity in class AbstractXmlParser
        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
      • handleText

        protected void handleText​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                  Sink sink)
                           throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Handles text events.

        This is a default implementation, if the parser points to a non-empty text element, it is emitted as a text event into the specified sink.

        Overrides:
        handleText in class AbstractXmlParser
        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
      • handleArticleInfoStartTags

        private void handleArticleInfoStartTags​(java.lang.String name,
                                                Sink sink,
                                                SinkEventAttributeSet attribs)
      • handleArticleInfoEndTags

        private void handleArticleInfoEndTags​(java.lang.String name,
                                              Sink sink)
      • handleCaptionEnd

        private void handleCaptionEnd​(Sink sink)
      • handleEmailStart

        private void handleEmailStart​(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
                                      Sink sink,
                                      SinkEventAttributeSet attribs)
                               throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException
      • handleSectionElements

        private void handleSectionElements​(Sink sink,
                                           java.lang.String name,
                                           SinkEventAttributeSet attribs)
      • handleImageDataStart

        private void handleImageDataStart​(Sink sink,
                                          SinkEventAttributeSet attribs)
                                   throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException
      • handleLinkStart

        private void handleLinkStart​(Sink sink,
                                     SinkEventAttributeSet attribs)
                              throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException
      • handleParaEnd

        private void handleParaEnd​(Sink sink)
      • handleTitleEnd

        private void handleTitleEnd​(Sink sink)
      • handleUlinkStart

        private void handleUlinkStart​(Sink sink,
                                      SinkEventAttributeSet attribs)
                               throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException
      • handleXrefStart

        private void handleXrefStart​(Sink sink,
                                     SinkEventAttributeSet attribs)
                              throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException
      • ignorable

        private boolean ignorable​(java.lang.String name)
      • isParent

        private boolean isParent​(java.lang.String element)
        Determines if the given element is a parent element.
        Parameters:
        element - the element to determine.
        Returns:
        true if the given element is a parent element.
      • linkStartTag

        private boolean linkStartTag​(java.lang.String name,
                                     Sink sink,
                                     SinkEventAttributeSet attribs)
                              throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException
      • mediaStartTag

        private boolean mediaStartTag​(java.lang.String name,
                                      Sink sink,
                                      SinkEventAttributeSet attribs)
                               throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
        Throws:
        org.codehaus.plexus.util.xml.pull.XmlPullParserException