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 Stefano Mazzocchi <st...@apache.org> on 1999/11/23 02:53:32 UTC

What happened to DOM support in FOP?

I find myself in the unhappy situation of a back incompatible change
that breaks Cocoon support.

True, I would crawl the DOM tree myself and throw SAX events to the
Driver, but why was it removed?

(nor that I like DOM support, but Cocoon is not (yet!) SAX based and I
still want to be able to support FOP!)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche


Re: What happened to DOM support in FOP?

Posted by Stefano Mazzocchi <st...@apache.org>.
Eric SCHAEFFER wrote:
> 
> I use Cocoon 1.4 with the latest version of FOP, and it work :
> 
> public class FOPFormatter implements Formatter, Status {
> 
>     public void format(Document document, Writer writer) throws Exception {
> //// TEST ////
>    Driver driver = new Driver();
>    driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
> org.apache.fop.apps.Version.getVersion());
>    driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
>    driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
>    driver.setWriter(new PrintWriter(writer));
>    driver.buildFOTree(document);
>    driver.format();
>    driver.render();
> 
> //        DOMProcessor fop = new DOMProcessor(document);
> //        fop.format(new PrintWriter(writer));
> //// TEST ////
>     }
> 
>     public String getMIMEType() {
>         return "application/pdf";
>     }
> 
>     public String getStatus() {
> //// TEST ////
>         return "TEST";
> //        return "James Tauber's " + com.jtauber.fop.Version.getVersion() +
> " formatter";
> //// TEST ////
>     }
> }

Sorry people, I'm a total idiot :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche



Re: What happened to DOM support in FOP?

Posted by Eric SCHAEFFER <es...@posterconseil.com>.
I use Cocoon 1.4 with the latest version of FOP, and it work :

public class FOPFormatter implements Formatter, Status {

    public void format(Document document, Writer writer) throws Exception {
//// TEST ////
   Driver driver = new Driver();
   driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
org.apache.fop.apps.Version.getVersion());
   driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
   driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
   driver.setWriter(new PrintWriter(writer));
   driver.buildFOTree(document);
   driver.format();
   driver.render();

//        DOMProcessor fop = new DOMProcessor(document);
//        fop.format(new PrintWriter(writer));
//// TEST ////
    }

    public String getMIMEType() {
        return "application/pdf";
    }

    public String getStatus() {
//// TEST ////
        return "TEST";
//        return "James Tauber's " + com.jtauber.fop.Version.getVersion() +
" formatter";
//// TEST ////
    }
}

_______________________________________

Eric SCHAEFFER
eschaeffer@posterconseil.com

POSTER CONSEIL
118 rue de Tocqueville
75017 PARIS
FRANCE
Tel. : 33-140541058
Fax : 33-140541059
_______________________________________

----- Original Message -----
From: James Tauber <jt...@jtauber.com>
To: <fo...@xml.apache.org>
Sent: Tuesday, November 23, 1999 5:47 AM
Subject: Re: What happened to DOM support in FOP?


> > I find myself in the unhappy situation of a back incompatible change
> > that breaks Cocoon support.
>
> When I wrote the Driver, I said it would break anything that embeds FOP
and
> I thought you said it was okay. It shouldn't take much to fix.
>
> > True, I would crawl the DOM tree myself and throw SAX events to the
> > Driver, but why was it removed?
>
> DOM support wasn't removed. It is incorporated into Driver.
>
> buildFOTree has two versions, one that takes a SAX Parser and InputSource
> and one that takes a DOM Document.
>
> Let me know if it doesn't work.
>
> James
>
>


Re: What happened to DOM support in FOP?

Posted by James Tauber <jt...@jtauber.com>.
> I find myself in the unhappy situation of a back incompatible change
> that breaks Cocoon support.

When I wrote the Driver, I said it would break anything that embeds FOP and
I thought you said it was okay. It shouldn't take much to fix.

> True, I would crawl the DOM tree myself and throw SAX events to the
> Driver, but why was it removed?

DOM support wasn't removed. It is incorporated into Driver.

buildFOTree has two versions, one that takes a SAX Parser and InputSource
and one that takes a DOM Document.

Let me know if it doesn't work.

James