On Thu, 8 Dec 2011, Andrzej Bialecki wrote:
I guess that could work, but it would be very messy - I would have to keep a list of all potentially interesting mime types in my code, which is difficult to maintain.
Or a list of interesting parsers in your other case!
It would be much better if the parent parser passed a token in metadata, basically saying "this is invoked from a XXXParser", so then I could detect that it was the PackageParser that invoked the method, and act accordingly.
You could turn it around a little bit. Call the detector to get the mimetype, then ask the composite parser for the right parser for that type. Based on what you get back, either do or don't supply the recursing parser to the parse context
(The detector and parser map are both available from AutoDetectParser) Nick
