Class DocBookParser
java.lang.Object
org.apache.maven.doxia.parser.AbstractParser
org.apache.maven.doxia.parser.AbstractXmlParser
org.apache.maven.doxia.module.docbook.DocBookParser
- All Implemented Interfaces:
LogEnabled
,Markup
,XmlMarkup
,DocbookMarkup
,SimplifiedDocbookMarkup
,Parser
@Component(role=Parser.class,
hint="docbook")
public class DocBookParser
extends AbstractXmlParser
implements DocbookMarkup, SimplifiedDocbookMarkup
Parse a
Simplified DocBook
document
and emit events into the specified doxia Sink.- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.maven.doxia.parser.AbstractXmlParser
AbstractXmlParser.CachedFileEntityResolver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Collection<String>
Simplified DocBook elements that occur within <articleinfo> and that are currently recognized by the parser.private static final Collection<String>
The list of DocBook elements that will be rendered inline and boldprivate static final Collection<String>
The list of DocBook elements that introduce a new level of hierarchy.private static final Collection<String>
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.private boolean
private boolean
private boolean
Used to distinguish italic from bold.private static final Collection<String>
The list of DocBook elements that will be rendered inline and italicprivate int
Level counter for calculating the section level.private static final Collection<String>
Simplified DocBook elements that are direct children of <article> and that should be emitted into the Sink's head.private static final Collection<String>
The list of DocBook elements that will be rendered inline and monospaceA selective stack of parent elementsprivate boolean
private char
private static final Collection<String>
The list of DocBook elements that will be rendered verbatimFields inherited from interface org.apache.maven.doxia.module.docbook.DocbookMarkup
ANCHOR_TAG, ARABIC_STYLE, ARTICLE_TAG, ARTICLEINFO_TAG, BOOK_TAG, BOOKINFO_TAG, CHAPTER_TAG, COLS_ATTRIBUTE, COLSEP_ATTRIBUTE, COLSPEC_TAG, CORPAUTHOR_TAG, DATE_TAG, DEFAULT_SGML_PUBLIC_ID, DEFAULT_SGML_SYSTEM_ID, DEFAULT_XML_PUBLIC_ID, DEFAULT_XML_SYSTEM_ID, EMAIL_TAG, ENTRY_TAG, FIGURE_TAG, FILEREF_ATTRIBUTE, FORMALPARA_TAG, FORMAT_ATTRIBUTE, FRAME_ATTRIBUTE, IMAGEDATA_TAG, IMAGEOBJECT_TAG, INFO_TAG, INFORMALFIGURE_TAG, INFORMALTABLE_TAG, ITEMIZEDLIST_TAG, LINK_TAG, LINKEND_ATTRIBUTE, LISTITEM_TAG, LOWERALPHA_STYLE, LOWERROMAN_STYLE, MEDIAOBJECT_TAG, NUMERATION_ATTRIBUTE, ORDEREDLIST_TAG, PARA_TAG, PROGRAMLISTING_TAG, ROW_TAG, ROWSEP_ATTRIBUTE, SECTION_TAG, SIMPARA_TAG, TBODY_TAG, TERM_TAG, TGROUP_TAG, THEAD_TAG, ULINK_TAG, UPPERALPHA_STYLE, UPPERROMAN_STYLE, URL_ATTRIBUTE, URL_TAG, VARIABLELIST_TAG, VARLISTENTRY_TAG, XREF_TAG
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.docbook.SimplifiedDocbookMarkup
ABBREV_TAG, ABSTRACT_TAG, ACRONYM_TAG, AFFILIATION_TAG, ANCHOR_TAG, APPENDIX_TAG, ARABIC_STYLE, ARTICLE_TAG, ARTICLEINFO_TAG, ATTRIBUTION_TAG, AUDIODATA_TAG, AUDIOOBJECT_TAG, AUTHOR_TAG, AUTHORBLURB_TAG, AUTHORGROUP_TAG, AUTHORINITIALS_TAG, BIBLIODIV_TAG, BIBLIOGRAPHY_TAG, BIBLIOMISC_TAG, BIBLIOMIXED_TAG, BIBLIOMSET_TAG, BLOCKQUOTE_TAG, CAPTION_TAG, CITETITLE_TAG, COL_TAG, COLGROUP_TAG, COLS_ATTRIBUTE, COLSEP_ATTRIBUTE, COLSPEC_TAG, COMMAND_TAG, COMPUTEROUTPUT_TAG, COPYRIGHT_TAG, CORPAUTHOR_TAG, DATE_TAG, DEFAULT_XML_PUBLIC_ID, DEFAULT_XML_SYSTEM_ID, EDITION_TAG, EDITOR_TAG, EMAIL_TAG, EMPHASIS_TAG, ENTRY_TAG, ENTRYTBL_TAG, EPIGRAPH_TAG, EXAMPLE_TAG, FIGURE_TAG, FILENAME_TAG, FILEREF_ATTRIBUTE, FIRSTNAME_TAG, FOOTNOTE_TAG, FOOTNOTEREF_TAG, FORMAT_ATTRIBUTE, FRAME_ATTRIBUTE, HOLDER_TAG, HONORIFIC_TAG, ID_ATTRIBUTE, IMAGEDATA_TAG, IMAGEOBJECT_TAG, INFORMALTABLE_TAG, INLINEMEDIAOBJECT_TAG, ISSUENUM_TAG, ITEMIZEDLIST_TAG, JOBTITLE_TAG, KEYWORD_TAG, KEYWORDSET_TAG, LANG_ATTRIBUTE, LEGALNOTICE_TAG, LINEAGE_TAG, LINEANNOTATION_TAG, LINK_TAG, LINKEND_ATTRIBUTE, LISTITEM_TAG, LITERAL_TAG, LITERALLAYOUT_TAG, LOWERALPHA_STYLE, LOWERROMAN_STYLE, MEDIAOBJECT_TAG, NOTE_TAG, NUMERATION_ATTRIBUTE, OBJECTINFO_TAG, OPTION_TAG, ORDEREDLIST_TAG, ORGNAME_TAG, OTHERCREDIT_TAG, OTHERNAME_TAG, PARA_TAG, PHRASE_TAG, PROGRAMLISTING_TAG, PUBDATE_TAG, PUBLISHERNAME_TAG, QUOTE_TAG, RELEASEINFO_TAG, REMAP_ATTRIBUTE, REPLACEABLE_TAG, REVDESCRIPTION_TAG, REVHISTORY_TAG, REVISION_TAG, REVISIONFLAG_ATTRIBUTE, REVNUMBER_TAG, REVREMARK_TAG, ROW_TAG, ROWSEP_ATTRIBUTE, SECTION_TAG, SECTIONINFO_TAG, SIDEBAR_TAG, SPANSPEC_TAG, SUBJECT_TAG, SUBJECTSET_TAG, SUBJECTTERM_TAG, SUBSCRIPT_TAG, SUBTITLE_TAG, SUPERSCRIPT_TAG, SURNAME_TAG, SYSTEMITEM_TAG, TABLE_TAG, TBODY_TAG, TD_TAG, TERM_TAG, TEXTDATA_TAG, TEXTOBJECT_TAG, TFOOT_TAG, TGROUP_TAG, TH_TAG, THEAD_TAG, TITLE_TAG, TITLEABBREV_TAG, TR_TAG, TRADEMARK_TAG, ULINK_TAG, UPPERALPHA_STYLE, UPPERROMAN_STYLE, URL_ATTRIBUTE, USERINPUT_TAG, VARIABLELIST_TAG, VARLISTENTRY_TAG, VIDEODATA_TAG, VIDEOOBJECT_TAG, VOLUMENUM_TAG, XREF_TAG, YEAR_TAG
Fields inherited from interface org.apache.maven.doxia.markup.XmlMarkup
BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
handleAnchorStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleArticleInfoEndTags
(String name, Sink sink) private void
handleArticleInfoStartTags
(String name, Sink sink, SinkEventAttributeSet attribs) private void
handleArticleStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleCaptionEnd
(Sink sink) private void
handleCaptionStart
(Sink sink, SinkEventAttributeSet attribs) protected void
handleCdsect
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) Handles CDATA sections.protected void
handleComment
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) Handles comments.private void
handleEmailStart
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs) protected void
handleEndTag
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) Goes through the possible end tags.protected void
handleEntity
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) Handles entities.private void
handleFigureStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleImageDataStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleItemizedListStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleLinkStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleListItemStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleOrderedListStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleParaEnd
(Sink sink) private void
handleParaStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleSectionElements
(Sink sink, String name, SinkEventAttributeSet attribs) protected void
handleStartTag
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) Goes through the possible start tags.private void
handleTableStart
(Sink sink, SinkEventAttributeSet attribs) protected void
handleText
(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) Handles text events.private void
handleTitleEnd
(Sink sink) private void
handleTitleStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleUlinkStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleVariableListStart
(Sink sink, SinkEventAttributeSet attribs) private void
handleXrefStart
(Sink sink, SinkEventAttributeSet attribs) private boolean
protected void
init()
Initialize the parser.private boolean
Determines if the given element is a parent element.private boolean
linkStartTag
(String name, Sink sink, SinkEventAttributeSet attribs) private boolean
listStartTags
(String name, Sink sink, SinkEventAttributeSet attribs) private boolean
mediaStartTag
(String name, Sink sink, SinkEventAttributeSet attribs) private boolean
styleStartTags
(String name, Sink sink, SinkEventAttributeSet attribs) private boolean
tableStartTags
(String name, Sink sink, SinkEventAttributeSet attribs) Methods inherited from class org.apache.maven.doxia.parser.AbstractXmlParser
getAttributesFromParser, getLocalEntities, getText, getType, handleUnknown, initXmlParser, isCollapsibleWhitespace, isIgnorableWhitespace, isTrimmableWhitespace, isValidate, parse, 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
-
Field Details
-
level
private int levelLevel counter for calculating the section level. -
isBold
private boolean isBoldUsed to distinguish italic from bold. -
inHead
private boolean inHead -
ignore
private boolean ignore -
simpleTag
private boolean simpleTag -
trademark
private char trademark -
parent
A selective stack of parent elements -
HIER_ELEMENTS
The list of DocBook elements that introduce a new level of hierarchy. -
META_ELEMENTS
Simplified DocBook elements that are direct children of <article> and that should be emitted into the Sink's head. -
ARTICLEINFO_ELEMENTS
Simplified DocBook elements that occur within <articleinfo> and that are currently recognized by the parser. -
VERBATIM_ELEMENTS
The list of DocBook elements that will be rendered verbatim -
BOLD_ELEMENTS
The list of DocBook elements that will be rendered inline and bold -
ITALIC_ELEMENTS
The list of DocBook elements that will be rendered inline and italic -
MONOSPACE_ELEMENTS
The list of DocBook elements that will be rendered inline and monospace -
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 Details
-
DocBookParser
public DocBookParser()
-
-
Method Details
-
init
protected void init()Initialize the parser. This is called first byAbstractParser.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 classAbstractParser
-
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 classAbstractXmlParser
- 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 modelMacroExecutionException
- 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 classAbstractXmlParser
- 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 modelMacroExecutionException
- 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 classAbstractXmlParser
- 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 classAbstractXmlParser
- 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 asnonBreakingSpace()
events.
- Overrides:
handleEntity
in classAbstractXmlParser
- 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
- the entities with names
-
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 classAbstractXmlParser
- 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
-
handleArticleInfoEndTags
-
handleCaptionStart
-
handleCaptionEnd
-
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
-
handleFigureStart
-
handleArticleStart
-
handleSectionElements
-
handleAnchorStart
-
handleImageDataStart
private void handleImageDataStart(Sink sink, SinkEventAttributeSet attribs) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException - Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
-
handleItemizedListStart
-
handleLinkStart
private void handleLinkStart(Sink sink, SinkEventAttributeSet attribs) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException - Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
-
handleListItemStart
-
handleOrderedListStart
-
handleParaEnd
-
handleParaStart
-
handleTableStart
-
handleTitleStart
-
handleTitleEnd
-
handleUlinkStart
private void handleUlinkStart(Sink sink, SinkEventAttributeSet attribs) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException - Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
-
handleVariableListStart
-
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
-
isParent
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(String name, Sink sink, SinkEventAttributeSet attribs) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException - Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
-
listStartTags
-
mediaStartTag
private boolean mediaStartTag(String name, Sink sink, SinkEventAttributeSet attribs) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException - Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
-
styleStartTags
-
tableStartTags
-