You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Vincent Hennebert <vh...@gmail.com> on 2009/09/11 11:55:46 UTC

Why does Fop.getDefaultHandler return a DefaultHandler?

Hi,

does anyone know why the o.a.f.apps.Fop.getDefaultHandler method returns
an instance of org.xml.sax.helpers.DefaultHandler and not just an
org.xml.sax.ContentHandler? Could that be changed?

Thanks,
Vincent

Re: Why does Fop.getDefaultHandler return a DefaultHandler?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hi Vincent

Why? Not sure. Couldn't reproduce that from the mailing list archives.

Changed? No, because it would break backwards-compatibility. What's the
motivation behind the question? Every DefaultHandler is a ContentHandler,
so this shouldn't be a problem.

Interesting case, BTW, if you go looking into the archives:
http://svn.apache.org/viewvc?view=rev&revision=197799 (Simon,
ContentHandler->DefaultHandler, adding ErrorListener methods to
FOTreeBuilder)
http://svn.apache.org/viewvc?view=rev&revision=197827 (Glen, Driver->Fop
refactoring)
http://svn.apache.org/viewvc?view=rev&revision=378482 (me, somehow losing
the ErrorListener methods during the refactoring, nobody missed them it
seems)

Maybe Simon remembers the details... That was soooo long ago. ;-)


On 11.09.2009 11:55:46 Vincent Hennebert wrote:
> Hi,
> 
> does anyone know why the o.a.f.apps.Fop.getDefaultHandler method returns
> an instance of org.xml.sax.helpers.DefaultHandler and not just an
> org.xml.sax.ContentHandler? Could that be changed?
> 
> Thanks,
> Vincent




Jeremias Maerki


Re: Why does Fop.getDefaultHandler return a DefaultHandler?

Posted by Simon Pepping <sp...@leverkruid.eu>.
I do not remember why I did that. Chris' argument is the most likely
reason. In the mentioned revision there is also a method that returns
FOTreeBuilder as a ContentHandler.

Simon

On Fri, Sep 11, 2009 at 03:49:00PM +0100, Chris Bowditch wrote:
> Vincent Hennebert wrote:
> >Hi,
> >
> >does anyone know why the o.a.f.apps.Fop.getDefaultHandler method returns
> >an instance of org.xml.sax.helpers.DefaultHandler and not just an
> >org.xml.sax.ContentHandler? Could that be changed?
> 
> Hi Vincent,
> 
> Why would you want to change it? As Jeremias already said
> DefaultHandler implemwents ContentHandler interface. I think the
> reason for doing such changes is that it can more easily be tied to
> a SAX stream stream using SAXParser.parse method. This method only
> accepts DefaultHandler not ContentHandler. Of course you can get a
> reference to the XMLReader and connect that to a ContentHandler but
> its just more convenient to use SAXParser.parse.
> 
> Regards,
> 
> Chris

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: Why does Fop.getDefaultHandler return a DefaultHandler?

Posted by Chris Bowditch <bo...@hotmail.com>.
Vincent Hennebert wrote:
> Hi,
> 
> does anyone know why the o.a.f.apps.Fop.getDefaultHandler method returns
> an instance of org.xml.sax.helpers.DefaultHandler and not just an
> org.xml.sax.ContentHandler? Could that be changed?

Hi Vincent,

Why would you want to change it? As Jeremias already said DefaultHandler 
implemwents ContentHandler interface. I think the reason for doing such 
changes is that it can more easily be tied to a SAX stream stream using 
SAXParser.parse method. This method only accepts DefaultHandler not 
ContentHandler. Of course you can get a reference to the XMLReader and 
connect that to a ContentHandler but its just more convenient to use 
SAXParser.parse.

Regards,

Chris