public abstract class ParserFactory extends Object
ParserFactoryimplemementations can be registered in
MimeLoolupeither for a specific mime type or for all languages. The example below shows
text/x-somethingmime type in an XML layer.
<folder name="Editors"> <folder name="text"> <folder name="x-something"> <file name="org-some-module-MyParserFactory.instance" /> </folder> </folder> </folder>
|Constructor and Description|
public abstract Parser createParser(Collection<Snapshot> snapshots)
Parser. In general parsers are created for either one or several snapshots (ie. document sections), which are provided to this method. It is guaranteed that all snapshots in the collection will be of the same mime type and it will be the mime type, which this factory was registered for (ie. in
MimeLookup). Typical factories won't need the snapshots for creating a parser, but factories that serve multiple languages (eg. in GSF or other language support frameworks) may find this useful.
It is important to remember that the snapshots are provided only
for the factory and they reflect document states at the time when the factory
is called. Since the parsing infrastructure may cache parser instances it
will provide a new snapshot when it asks
Parsers to do their job.
Therefore the snapshots here may only be used for the parser creation, but must
never be used for parsing!
snapshots- Snaphots of documents, which the new parser will be asked to parse.
nullif this factory does not have a parser suitable for parsing this type of snapshots.
Built on June 18 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.