org.xwiki.rendering.internal.parser.xml
Class AbstractStreamParser
java.lang.Object
org.xwiki.rendering.internal.parser.xml.AbstractStreamParser
- All Implemented Interfaces:
- Initializable, StreamParser, ContentHandlerStreamParserFactory
- Direct Known Subclasses:
- AbstractParser
public abstract class AbstractStreamParser
- extends Object
- implements ContentHandlerStreamParserFactory, StreamParser, Initializable
Base class for XML based syntax stream parsers.
- Since:
- 3.3M1
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
componentManager
@Inject
protected ComponentManager componentManager
- Used to lookup parser instances.
AbstractStreamParser
public AbstractStreamParser()
initialize
public void initialize()
throws InitializationException
- Description copied from interface:
Initializable
- Method called by the Component Manager when the component is created for the first time (i.e. when it's looked up
for the first time or if the component is specified as being loaded on startup). If the component instantiation
strategy is singleton then this method is called only once during the lifecycle of the Component Manager.
Otherwise the component is created at each lookup and thus this method is called at each lookup too.
- Specified by:
initialize
in interface Initializable
- Throws:
InitializationException
- if an error happens during a component's initialization
createParser
public ContentHandlerStreamParser createParser(Listener listener)
- Specified by:
createParser
in interface ContentHandlerStreamParserFactory
- Parameters:
listener
- the listener to send rendering events to
- Returns:
- the new
ContentHandlerStreamParser
instance.
parse
public void parse(Reader source,
Listener listener)
throws ParseException
- Specified by:
parse
in interface StreamParser
- Parameters:
source
- the content to parselistener
- receive event for each element
- Throws:
ParseException
- if the source cannot be read or an unexpected error happens during the parsing. Parsers
should be written to not generate any error as much as possible.
parseXML
public void parseXML(Reader source,
Listener listener)
throws ParserConfigurationException,
SAXException,
IOException
- Parameters:
source
- the content to parselistener
- receive event for each element
- Throws:
ParserConfigurationException
- error when rendering
SAXException
- error when rendering
IOException
- error when rendering