Can you please give a little more context (i.e. more code)? I don't
understand what exactly you want to do. I thought you had a SAX XML
source, not an XML file source.

On 08.12.2005 13:56:27 Peter.Neu wrote:
> Hello,
> 
> I have a hard time getting the Obj2Pdf Example to work with my application.
> I was browsing through the FAQ and found another example 
> 
> http://xmlgraphics.apache.org/fop/0.20.5/servlets.html#xslt
> 
> But also here is the problem I don't know how to pass the generated xml file
> to a File object. 
> 
> The critical line is this one: 
> Source src = new StreamSource(new File("foo.xml")); <- Streaming?
> 
> How can I stream my xml document in this object? My transformation is a
> simple SAX transformation.
> 
> cheers,
> Pete
> 
> 
> > --- Ursprüngliche Nachricht ---
> > Von: [EMAIL PROTECTED]
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > Datum: Thu, 8 Dec 2005 08:54:10 +0100 (MET)
> > 
> > Hello Jeremias,
> > 
> > good your are in the cet time zone,too ;o). 
> > My code also uses sax so the refactoring process will not be that long.
> > Anyway it's always good to have a working example so I'll adapt to that. 
> > I'll be back with details when I'm done refactoring.
> > 
> > cheers,
> > Pete
> > 
> > 
> > 
> > 
> > > --- Ursprüngliche Nachricht ---
> > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > Datum: Thu, 08 Dec 2005 08:32:55 +0100
> > > 
> > > Pete,
> > > 
> > > I see. No, in this case you're not missing anything although you may not
> > > need to rewrite your whole code just to accomodate the new pattern.
> > > Generating XML using SAX events is one way to generate XML, a good way
> > > but not necessarily the only one. Remember that JAXP is quite flexible
> > > and that you could use a DOMSource, for example, if you've already got
> > > code that generates a DOM from your data. The purpose of the examples in
> > > the examples/embedding directory are to show a gradual approach to the
> > > patterns that we suggest people use. The benefit out of this is a
> > > flexible and quick solution.
> > > 
> > > On 08.12.2005 08:20:49 Peter.Neu wrote:
> > > > Hi Jeremias,
> > > > 
> > > > I was refering to Obj2PDF because this is the only example which shows
> > > how
> > > > to generate XML and then pass it to the FOP Transformation. XML2PDF
> > > works
> > > > with a static and already existing xml file. So the whole point was
> > how
> > > to
> > > > pass a generated xml file to fop without writing it to the file
> > system.
> > > > Using the Obj2PDF requires a lot of refactoring in my code but that is
> > > the
> > > > only option I got I suppose, or am I missing something?
> > > > 
> > > > cheers,
> > > > Pete 
> > > > 
> > > > > --- Ursprüngliche Nachricht ---
> > > > > Von: Jeremias Maerki <[EMAIL PROTECTED]>
> > > > > An: fop-users@xmlgraphics.apache.org
> > > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > > Datum: Wed, 07 Dec 2005 21:44:38 +0100
> > > > > 
> > > > > Yes, that's basically it, though ExampleObj2PDF is a bit special.
> > > > > ExampleXML2PDF is the more generic example. And yes, it works in a
> > > > > webapp.
> > > > > 
> > > > > On 07.12.2005 21:39:58 Peter.Neu wrote:
> > > > > > Hi Glenn
> > > > > > 
> > > > > > did you mean this example? Taken from [1]. Does this work in a
> > > webapp?
> > > > > > 
> > > > > > 
> > > > > > //Setup output
> > > > > > OutputStream out = new java.io.FileOutputStream(pdf);
> > > > > >   try {
> > > > > >       driver.setOutputStream(out);
> > > > > >       //Setup XSLT
> > > > > >       TransformerFactory factory =
> > TransformerFactory.newInstance();
> > > > > >       Transformer transformer = factory.newTransformer(new        
> >  
> > >    
> > > > > > StreamSource(xslt));
> > > > > >      //Setup input for XSLT transformation
> > > > > >      Source src = team.getSourceForProjectTeam();
> > > > > >     //Resulting SAX events (the generated FO) must be piped
> > through
> > > to
> > > > > FOP
> > > > > >      Result res = new SAXResult(driver.getContentHandler());
> > > > > > 
> > > > > >    //Start XSLT transformation and FOP processing
> > > > > >     transformer.transform(src,
> > > > > > res);
> > > > > > 
> > > > > >
> > > > >
> > > >
> > >
> >
> [1]http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup
> > > > > > 
> > > > > > 
> > > > > > cheers,
> > > > > > Pete
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > > --- Ursprüngliche Nachricht ---
> > > > > > > Von: Glen Mazza <[EMAIL PROTECTED]>
> > > > > > > An: fop-users@xmlgraphics.apache.org
> > > > > > > Betreff: Re: How to pass input of xml tranfs. to xslt transf. ?
> > > > > > > Datum: Wed, 07 Dec 2005 12:41:24 -0500
> > > > > > > 
> > > > > > > Don't use XSLTInputHandler.  Use JAXP[1] instead.
> > > > > > > 
> > > > > > > Glen
> > > > > > > 
> > > > > > > [1]
> > > http://xmlgraphics.apache.org/fop/0.20.5/embedding.html#examples
> > > > > > > 
> > > > > > > [EMAIL PROTECTED] wrote:
> > > > > > > 
> > > > > > > >Hello,
> > > > > > > >
> > > > > > > >I struggling to create a webapps that creates pdf's for xml
> > > > > documents.
> > > > > > > The
> > > > > > > >problem is: I can't pipe the output of my SAX transformation to
> > > the 
> > > > > > > >XSLTInputHandler. 
> > > > > > > >
> > > > > > > >My code uses a static xsl document and dynamic xml documents.
> > For
> > > > > > > >demonstration purposes I create the xml file on the local
> > > filesystem
> > > > > but
> > > > > > > >that'S not very good for my webapplication :o/
> > > > > > > >
> > > > > > > >Here the code:
> > > > > > > >
> > > > > > > >File xmlfile = new
> > > > > File(session.getServletContext().getRealPath("/xml/"),
> > > > > > > >"nbw.xml");
> > > > > > > >OutputStream out = new java.io.FileOutputStream(xmlfile);
> > > > > > > >StreamResult streamResult = new StreamResult(out);
> > > > > > > >SAXTransformerFactory tf = (SAXTransformerFactory)
> > > > > > > >SAXTransformerFactory.newInstance();
> > > > > > > >TransformerHandler hd = tf.newTransformerHandler();
> > > > > > > >Transformer serializer = hd.getTransformer();
> > > > > > > >serializer.setOutputProperty(OutputKeys.ENCODING,
> > "ISO-8859-1");
> > > > > > > >serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> > > > > > > >hd.setResult(streamResult);
> > > > > > > >
> > > > > > > >//Custom transformation with SAX
> > > > > > > >XmlTransformer xmlt = new XmlTransformer(hd);
> > > > > > > >String xslParam =
> > > > > > > session.getServletContext().getRealPath("/xml/nbw.xsl");
> > > > > > > >String xmlParam =
> > > > > > > session.getServletContext().getRealPath("/xml/nbw.xml");
> > > > > > > >
> > > > > > > >File xmlFile = new File(xmlParam);
> > > > > > > >
> > > > > > > >//XSLT Transformation
> > > > > > > >XSLTInputHandler input = 
> > > > > > > >new XSLTInputHandler(xmlFile, new File((xslParam)));
> > > > > > > >
> > > > > > > >renderXML(input, response);
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >cheers,
> > > > > > > >Pete
> > > > > > > >
> > > > > 
> > > > > 
> > > > > Jeremias Maerki
> > > 
> > > 
> > > Jeremias Maerki
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > 
> > -- 
> > 10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
> > +++ GMX - die erste Adresse für Mail, Message, More +++
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
> Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to