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 DocBook
document and emit events into the specified doxia Sink.- Since:
- 1.0
- Version:
- $Id$
-
-
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_ELEMENTS
Simplified DocBook elements that occur within <articleinfo> and that are currently recognized by the parser.private static java.util.Collection<java.lang.String>
BOLD_ELEMENTS
The list of DocBook elements that will be rendered inline and boldprivate static java.util.Collection<java.lang.String>
HIER_ELEMENTS
The list of DocBook elements that introduce a new level of hierarchy.private static 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.private boolean
ignore
private boolean
inHead
private boolean
isBold
Used to distinguish italic from bold.private static java.util.Collection<java.lang.String>
ITALIC_ELEMENTS
The list of DocBook elements that will be rendered inline and italicprivate int
level
Level counter for calculating the section level.private static 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.private static java.util.Collection<java.lang.String>
MONOSPACE_ELEMENTS
The list of DocBook elements that will be rendered inline and monospaceprivate java.util.Stack<java.lang.String>
parent
A selective stack of parent elementsprivate boolean
simpleTag
private char
trademark
private static java.util.Collection<java.lang.String>
VERBATIM_ELEMENTS
The 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 void
handleAnchorStart(Sink sink, SinkEventAttributeSet attribs)
private void
handleArticleInfoEndTags(java.lang.String name, Sink sink)
private void
handleArticleInfoStartTags(java.lang.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, java.lang.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
ignorable(java.lang.String name)
protected void
init()
Initialize the parser.private boolean
isParent(java.lang.String element)
Determines if the given element is a parent element.private boolean
linkStartTag(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
private boolean
listStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
private boolean
mediaStartTag(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
private boolean
styleStartTags(java.lang.String name, Sink sink, SinkEventAttributeSet attribs)
private boolean
tableStartTags(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:
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
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)
-
-