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 aSimplified DocBookdocument 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
Fields Modifier and Type Field Description private static java.util.Collection<java.lang.String>ARTICLEINFO_ELEMENTSSimplified DocBook elements that occur within <articleinfo> and that are currently recognized by the parser.private static java.util.Collection<java.lang.String>BOLD_ELEMENTSThe list of DocBook elements that will be rendered inline and boldprivate static java.util.Collection<java.lang.String>HIER_ELEMENTSThe list of DocBook elements that introduce a new level of hierarchy.private static java.util.Collection<java.lang.String>IGNORABLE_ELEMENTSThe 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 booleanignoreprivate booleaninHeadprivate booleanisBoldUsed to distinguish italic from bold.private static java.util.Collection<java.lang.String>ITALIC_ELEMENTSThe list of DocBook elements that will be rendered inline and italicprivate intlevelLevel counter for calculating the section level.private static java.util.Collection<java.lang.String>META_ELEMENTSSimplified DocBook elements that are direct children of <article> and that should be emitted into the Sink's head.private static java.util.Collection<java.lang.String>MONOSPACE_ELEMENTSThe list of DocBook elements that will be rendered inline and monospaceprivate java.util.Stack<java.lang.String>parentA selective stack of parent elementsprivate booleansimpleTagprivate chartrademarkprivate static java.util.Collection<java.lang.String>VERBATIM_ELEMENTSThe list of DocBook elements that will be rendered verbatim-
Fields 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 Constructor Description DocBookParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidhandleAnchorStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleArticleInfoEndTags(java.lang.String name, Sink sink)private voidhandleArticleInfoStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)private voidhandleArticleStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleCaptionEnd(Sink sink)private voidhandleCaptionStart(Sink sink, SinkEventAttributeSet attribs)protected voidhandleCdsect(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink)Handles CDATA sections.protected voidhandleComment(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink)Handles comments.private voidhandleEmailStart(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs)protected voidhandleEndTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink)Goes through the possible end tags.protected voidhandleEntity(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink)Handles entities.private voidhandleFigureStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleImageDataStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleItemizedListStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleLinkStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleListItemStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleOrderedListStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleParaEnd(Sink sink)private voidhandleParaStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleSectionElements(Sink sink, java.lang.String name, SinkEventAttributeSet attribs)protected voidhandleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink)Goes through the possible start tags.private voidhandleTableStart(Sink sink, SinkEventAttributeSet attribs)protected voidhandleText(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink)Handles text events.private voidhandleTitleEnd(Sink sink)private voidhandleTitleStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleUlinkStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleVariableListStart(Sink sink, SinkEventAttributeSet attribs)private voidhandleXrefStart(Sink sink, SinkEventAttributeSet attribs)private booleanignorable(java.lang.String name)protected voidinit()Initialize the parser.private booleanisParent(java.lang.String element)Determines if the given element is a parent element.private booleanlinkStartTag(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)private booleanlistStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)private booleanmediaStartTag(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)private booleanstyleStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)private booleantableStartTags(java.lang.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, parse, setCollapsibleWhitespace, setIgnorableWhitespace, setTrimmableWhitespace, setValidate
-
Methods inherited from class org.apache.maven.doxia.parser.AbstractParser
doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, isEmitComments, isSecondParsing, parse, setEmitComments, setSecondParsing
-
-
-
-
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.
-
-
Method Detail
-
init
protected void init()
Initialize the parser. This is called first byParser.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:
initin classAbstractParser
-
handleStartTag
protected void handleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, Sink sink) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, MacroExecutionExceptionGoes through the possible start tags.- Specified by:
handleStartTagin 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, MacroExecutionExceptionGoes through the possible end tags.- Specified by:
handleEndTagin 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.XmlPullParserExceptionHandles comments.This is a default implementation, all data are emitted as comment events into the specified sink.
- Overrides:
handleCommentin 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.XmlPullParserExceptionHandles CDATA sections.This is a default implementation, all data are emitted as text events into the specified sink.
- Overrides:
handleCdsectin 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.XmlPullParserExceptionHandles 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,nbspand#x00A0are emitted asnonBreakingSpace()events.
- Overrides:
handleEntityin 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.XmlPullParserExceptionHandles 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:
handleTextin 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
private void handleArticleInfoStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
-
handleArticleInfoEndTags
private void handleArticleInfoEndTags(java.lang.String name, Sink sink)
-
handleCaptionStart
private void handleCaptionStart(Sink sink, SinkEventAttributeSet attribs)
-
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
-
handleFigureStart
private void handleFigureStart(Sink sink, SinkEventAttributeSet attribs)
-
handleArticleStart
private void handleArticleStart(Sink sink, SinkEventAttributeSet attribs)
-
handleSectionElements
private void handleSectionElements(Sink sink, java.lang.String name, SinkEventAttributeSet attribs)
-
handleAnchorStart
private void handleAnchorStart(Sink sink, 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
-
handleItemizedListStart
private void handleItemizedListStart(Sink sink, SinkEventAttributeSet attribs)
-
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
private void handleListItemStart(Sink sink, SinkEventAttributeSet attribs)
-
handleOrderedListStart
private void handleOrderedListStart(Sink sink, SinkEventAttributeSet attribs)
-
handleParaEnd
private void handleParaEnd(Sink sink)
-
handleParaStart
private void handleParaStart(Sink sink, SinkEventAttributeSet attribs)
-
handleTableStart
private void handleTableStart(Sink sink, SinkEventAttributeSet attribs)
-
handleTitleStart
private void handleTitleStart(Sink sink, SinkEventAttributeSet attribs)
-
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
-
handleVariableListStart
private void handleVariableListStart(Sink sink, SinkEventAttributeSet attribs)
-
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
-
listStartTags
private boolean listStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
-
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
-
styleStartTags
private boolean styleStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
-
tableStartTags
private boolean tableStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
-
-