public abstract class AbstractParser extends Object implements Parser
TXT_TYPE, UNKNOWN_TYPE, XML_TYPE| Constructor and Description |
|---|
AbstractParser() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSinkWrapperFactory(SinkWrapperFactory factory)
Registers a given
SinkWrapperFactory with the parser used in subsequent calls of parse(...) |
protected static String |
doxiaVersion()
The current Doxia version.
|
void |
executeMacro(String macroId,
MacroRequest request,
Sink sink)
Execute a macro on the given sink.
|
protected File |
getBasedir()
Deprecated.
this does not work in multi-module builds, see DOXIA-373
|
protected MacroManager |
getMacroManager()
Gets the current
MacroManager. |
protected List<SinkWrapperFactory> |
getSinkWrapperFactories()
Returns all sink wrapper factories (both registered automatically and manually).
|
int |
getType()
|
protected Sink |
getWrappedSink(Sink sink)
Creates a sink pipeline built from all registered
SinkWrapperFactory objects. |
protected void |
init()
Initialize the parser.
|
boolean |
isEmitAnchorsForIndexableEntries()
Returns whether anchors are automatically generated for each index entry found by
IndexingSink or not. |
boolean |
isEmitComments()
isEmitComments.
|
protected boolean |
isSecondParsing()
Indicates if we are currently parsing a second time.
|
void |
parse(Reader source,
Sink sink)
Parses the given source model and emits Doxia events into the given sink.
|
void |
parse(String string,
Sink sink)
Convenience method to parse an arbitrary string and emit events into the given sink.
|
void |
parse(String string,
Sink sink,
String reference)
Convenience method to parse an arbitrary string and emit events into the given sink.
|
void |
setEmitAnchorsForIndexableEntries(boolean emitAnchors)
Determines whether to automatically generate anchors for each index entry found by
IndexingSink or not. |
void |
setEmitComments(boolean emitComments)
When comments are found in source markup, emit comment Doxia events or just ignore?
|
void |
setSecondParsing(boolean second)
Set
secondParsing to true, if this represents a secondary parsing of the same source. |
public AbstractParser()
public void setEmitComments(boolean emitComments)
setEmitComments in interface ParseremitComments - true (default value) to emit comment Doxia eventspublic boolean isEmitComments()
isEmitComments.
isEmitComments in interface Parserpublic boolean isEmitAnchorsForIndexableEntries()
ParserIndexingSink or not.isEmitAnchorsForIndexableEntries in interface Parsertrue if anchors are emitted otherwise falsepublic void setEmitAnchorsForIndexableEntries(boolean emitAnchors)
ParserIndexingSink or not.
By default no anchors are generated.setEmitAnchorsForIndexableEntries in interface ParseremitAnchors - true to emit anchors otherwise false (the default)public void executeMacro(String macroId, MacroRequest request, Sink sink) throws MacroExecutionException, MacroNotFoundException
macroId - an id to lookup the macrorequest - the corresponding MacroRequestsink - the sink to receive the eventsMacroExecutionException - if an error occurred during executionMacroNotFoundException - if the macro could not be foundprotected File getBasedir()
public void parse(String string, Sink sink) throws ParseException
string - a string that provides the source inputsink - a sink that consumes the Doxia eventsParseException - if the string could not be parsedpublic void parse(String string, Sink sink, String reference) throws ParseException
string - a string that provides the source inputsink - a sink that consumes the Doxia eventsreference - a string containing the reference to the source of the input string (e.g. filename)ParseException - if the string could not be parsedpublic void parse(Reader source, Sink sink) throws ParseException
Parser.parse(Reader, Sink, String) with last argument being null.parse in interface Parsersource - not null reader that provides the source document.
You could use newReader methods from ReaderFactory.sink - A sink that consumes the Doxia events.ParseException - if the model could not be parsed.protected Sink getWrappedSink(Sink sink)
SinkWrapperFactory objects.
For secondary parsers (i.e. ones with isSecondParsing() returning true just the given original sink is returned.sink - public void setSecondParsing(boolean second)
secondParsing to true, if this represents a secondary parsing of the same source.second - true for second parsingprotected boolean isSecondParsing()
public void addSinkWrapperFactory(SinkWrapperFactory factory)
ParserSinkWrapperFactory with the parser used in subsequent calls of parse(...)addSinkWrapperFactory in interface Parserfactory - the factory to create the sink wrapperprotected List<SinkWrapperFactory> getSinkWrapperFactories()
protected MacroManager getMacroManager()
MacroManager.MacroManagerprotected void init()
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.protected static String doxiaVersion()
Copyright © 2005–2024 The Apache Software Foundation. All rights reserved.