sax conflicts with tomcat-4.0.2-LE-jdk1.4
hi, does anyone on this list know the scoop on what xml parser or parsers one should be using for future work... and what Fop should be using? tomcat-4 seems to have been waffling. 4.0 came with crimson, 4.0.1 came with xerces, and now there's 4.0.2-LE-jdk1.4 designed to operation with the almost-out jdk1.4. which incorporates a lot of useful stuff like jsse, maybe javamail, xalan, and ... crimson! i like crimson fine - it's smaller than xerces - and if sun is going to be taking ownership of xml parsing, maybe projects like Fop should start conforming to the dictators in palo alto. i've used JAXP and SAX APIs pretty heavily and i can't say i notice much difference, but Fop is decidedly unhappy with jdk1.4, which lacks xml.serialize. this is too hard. i just want to use Fop with tomcat. hoo boy, and don't get me started about the servlet API and Fop's need for OutputStreams when all JSP will give you are Writers..
Re: sax conflicts with tomcat-4.0.2-LE-jdk1.4
i've used JAXP and SAX APIs pretty heavily and i can't say i notice much difference, but Fop is decidedly unhappy with jdk1.4, which lacks xml.serialize. As far as i can tell xml.serialize is only used at build time for extracting font data in FOP. I personally run FOP in an environment without Xerces/Xalan and therefore lacking the serialization features without problems (using Saxon). interesting! i had no such luck de-contenting, at least using a binary distro of Fop. this is too hard. i just want to use Fop with tomcat. Can you describe your problems a little bit more detailed? tomcat comes with xerces or crimson. the new 4.0.2-LE-jdk1.4 distro comes with nothing but uses crimson (jaxp) and whatever xalan is in jdk1.4. by "comes with", i mean there are directories $TOMCAT/common/lib and $TOMCAT/server/lib for putting .jar files in. things in common/lib are available to tomcat itself and applications, things in server/lib are available only to tomcat. i have my own xml library that runs on top of sax or jaxp with minor changes, so i need something in common/lib. it took me a couple days to get tomcat 4.0.1, my stuff, and Fop-0.20.3rc all using the same world (xerces/xalan), and now i see this apparent push to go back to jaxp/crimson. it shouldn't matter, but it does, and it's unpleasant to have trouble combining projects from apache.org. so i'm hoping to see some consolidation, or at least agreement of what toolsets things will be using. i think having an LE-jdk1.4 edition of tomcat is nice in principle - fewer .jar files to deploy is easier on everyone - but if the result is more forks elsewhere in the developer community, well..
Re: sax conflicts with tomcat-4.0.2-LE-jdk1.4
for OutputStreams when all JSP will give you are Writers.. JSP is bad for your mental health anyway :-) uh oh, you got me started... i rather like JSP (in principle) and the idea of developing tags for use by UI and layout people. can even be a true pipeline with a little tomcat hacking to avoid those stupid BodyContent things. looking at the code generated by a JSP compiler does give my stomach a turn, and the Writer/OutputStream problem rears its ugly head with Fop. i can see why Fop doesn't deal with Writers - all of the Image serialization things i've seen use OutputStreams exclusively. plus, sun appears to finally be making a push in jdk1.4 to make byte streams go fast. no idea what this will do to JSP. but without Fop able to use Writers the above pipeline is going to have a byte->char->byte thing going on, just waiting for a unicode/buffer-alignment bug to pop up a year from now.
Re: Pipe XSLT Transform to FOP
Could anyone point me in the right direction of how I could transform my XML to PDF without creating an intermediate file? send your XML to a PipedOutputStream pos and use an InputSource(pos.getInputStream()) make your XML thing a Thread and start() it.
Re: Pipe XSLT Transform to FOP
yah i've looked at cocoon, and sorry to say but i'm not interested. tag extension, which jsp does okay but not great, is what i want to "separate logic from presentation". i can pipe and do even more amazing stuff with cleverly designed tags and a slightly hacked tomcat. i just wish the servlet API didn't have such weird holes and that java wasn't so schizo about bytes/chars. Bertrand Delacretaz wrote: On Tuesday 12 February 2002 02:00, Ryan Howe wrote: I have been looking for a way to pipe the output of my Transformer into the Input of the FOP Driver object. Cocoon (xml.apache.org/cocoon) does just that and much more - you might want to have a look!
Re: sax conflicts with tomcat-4.0.2-LE-jdk1.4
jaxp has some org.apache.xml things in it, and jdk1.4's rt.jar has both crimson and xalan in it. the tomcat distros 4.0, 4.0.1, and 4.0.2 seem to all have different ideas of what xml parsers to present. they're always exposed in common/lib but users are invited to replace them with whatever. 4.0: crimson 4.0.1: xerces 4.0.2: xerces 4.0.2-LE-jdk1.4: nothing (but crimson in jdk1.4) Would be interesting if FOP was fixed this way and therefore became more independent of the underlying XML libraries. In fact, it should be possible to get rid of all org.apache.x*.* imports and references and to solely rely on JAXP classes and methods. The only place where Xerces is directly imported is the PFMReader and TTFReader. Ok, Driver, when startet using the command line, uses Xerces by default, but nothing prevents you from using any JAXP parser with FOP. I also vaguely remember that recent tomcat releases no longer exposes its XML parser to servlets per default, this may also be a source of confusion. The docs have a method how to get the parser back. Cheers, Jeremias Märki mailto:[EMAIL PROTECTED] OUTLINE AG Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern Fon +41 41 317 20 20 - Fax +41 41 317 20 29 Internet http://www.outline.ch
Re: Making FO
xslt was created for doing just this. it's a very important technology and there are finally some good books on it. Does anybody know any good tool for converting HTML (or rtf, or doc) to FO. I have tried html2fo, which I had found on sourceforge.net, but it doesn't understand styles and some tags. Maybe anybody know a better tool? Aleksei Vassiljev
Re: FOP and servlets
application/x-pdf, not application/pdf [EMAIL PROTECTED] wrote: Hi, I've been using FOP for a few days and i have a problem with displaying PDF through a browser with FOP. I'm using FOP 0.20.1 with Xalan 1.2 and Xerces 1.2. Here's a sample of my servlet source : String xmlString = request.getParameter("XML"); String xslString = resquest.getParameter("XSL"); ByteArrayOutputStream fo = new ByteArrayOutputStream(); //XSLT transformation XSLTProcessor lProcessor = XSLTProcessorFactory.getProcessor(); lProcessor.process(new XSLTInputSource(new StringReader(xmlString)), new XSLTInputSource(new StringReader(xslString), new XLSTResultTarget(fo)); // PDF generation with FOP Driver lFOPDriver = new Driver(); InputSource FOSource = new InputSource(fo); response.setContentType("application/pdf"); ServletOutputStream output = response.getOutputStream(); lFOPDriver.setOutputStream(output); lFOPDriver.setRenderer(RENDER_PDF); XMLReader reader = (XMLReader) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance(); lFOPDriver.setXmlReader(reader); lFOPDriver.setInputSource(FOSource); lFOPDriver.run(); output.flush(); output.close(); When I call this servlet, the browser don't display the generated PDF but I 've noticed that it appears in my Temporary Internet Files. Does anyone have an idea ? Regards. JD. Faites un voeu et puis Voila ! www.voila.fr Avec Voila Mail, consultez vos e-mails sur votre mobile Wap.
Re: A brain teaser
the xsl:fo way of doing what you want isn't pretty, but it's a very standard wish in book formatting. after you figure it out, you will wonder how else it could have been defined. the tutorial chapter below pretty much explains how to do this: http://www.dpawson.co.uk/xsl/sect3/bk/ch05.html#d0e1929 in the code submitted already, i would have used page-position="rest" rather than odd-or-even="any", but i don't think it would make a diff. the hard part has to do with the so-called "static content" written to the page masters, eg: first page header goo other page header goo ... where "first-before" and "rest-before" talk about areas on the two page masters you define. Perhaps i should have explained, the subsequent headers are different from the first header. The first version, Magnus' version, produced two documents. The first one had the special headers and the second one had the ordinary ones. The second version does the same. I don't see how the content of the headers will change. Granted, the margin size will change. But I need what is contained in the header on the subsequent pages to be different from what is at the top of the first page. Are we to conclude that it can't be done? I'm concluding this can't be done. {:( -- Best, Stephen - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 15, 2002 2:59 PM Subject: Re: A brain teaser odd-or-even="any" master-name="main"/>
Re: A brain teaser
then thank you thank you thank you both for that wonderful book! hands down the best reference i've seen on fo. Arved Sandstrom wrote: I happen to be liable for the content of that particular tutorial chapter. Dave Pawson did most of the work relating to making it look really good, with DocBook tweaking. But I take responsibility for errors. Mostly it is pretty solid, but I do have to point out one error, which relates to "reference-orientation". The sense of rotation is right-hand-rule; that is, positive rotations are CCW. So 90 degrees is 9 o'clock, _not_ 3 o'clock as stated in the tutorial. Any references in this chapter to specific values should take this into account: for example, Fig 5.3. I've been promising Dave to submit some patches; I guess I should get hot on that. Regards, Arved Sandstrom -----Original Message- From: Bart Locanthi [mailto:[EMAIL PROTECTED] Sent: February 16, 2002 1:12 AM To: [EMAIL PROTECTED] Subject: Re: A brain teaser the xsl:fo way of doing what you want isn't pretty, but it's a very standard wish in book formatting. after you figure it out, you will wonder how else it could have been defined. the tutorial chapter below pretty much explains how to do this: http://www.dpawson.co.uk/xsl/sect3/bk/ch05.html#d0e1929 in the code submitted already, i would have used page-position="rest" rather than odd-or-even="any", but i don't think it would make a diff. the hard part has to do with the so-called "static content" written to the page masters, eg: first page header goo other page header goo ... where "first-before" and "rest-before" talk about areas on the two page masters you define. Perhaps i should have explained, the subsequent headers are different from the first header. The first version, Magnus' version, produced two documents. The first one had the special headers and the second one had the ordinary ones. The second version does the same. I don't see how the content of the headers will change. Granted, the margin size will change. But I need what is contained in the header on the subsequent pages to be different from what is at the top of the first page. Are we to conclude that it can't be done? I'm concluding this can't be done. {:( -- Best, Stephen - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 15, 2002 2:59 PM Subject: Re: A brain teaser odd-or-even="any" master-name="main"/>
Re: A brain teaser
see later message.. apologies to you and anyone else who got the idea that i wrote or claimed to have written that tutorial. after pawing through other, otherwise excellent xslt references, it was that one that brought me out of the darkness regarding xsl:fo. thanks again to the dave pawson and arved sandstrom. may their work bring them fame and fortune when it gets to print. Stephen Clarke wrote: Hi Bart, Aha! Thankyou. Thanks much for going that extra step to confer the benefit of your superior understanding upon this wayward rapscallion. At last I've got it. Soon I'll be a world class online typographer, right? {:-) -- Best, Stephen - Original Message ----- From: "Bart Locanthi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, February 16, 2002 5:11 AM Subject: Re: A brain teaser the xsl:fo way of doing what you want isn't pretty, but it's a very standard wish in book formatting. after you figure it out, you will wonder how else it could have been defined. the tutorial chapter below pretty much explains how to do this: http://www.dpawson.co.uk/xsl/sect3/bk/ch05.html#d0e1929 in the code submitted already, i would have used page-position="rest" rather than odd-or-even="any", but i don't think it would make a diff. the hard part has to do with the so-called "static content" written to the page masters, eg: first page header goo other page header goo ... where "first-before" and "rest-before" talk about areas on the two page masters you define. Perhaps i should have explained, the subsequent headers are different from the first header. The first version, Magnus' version, produced two documents. The first one had the special headers and the second one had the ordinary ones. The second version does the same. I don't see how the content of the headers will change. Granted, the margin size will change. But I need what is contained in the header on the subsequent pages to be different from what is at the top of the first page. Are we to conclude that it can't be done? I'm concluding this can't be done. {:( -- Best, Stephen - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 15, 2002 2:59 PM Subject: Re: A brain teaser odd-or-even="any" master-name="main"/>
Re: NullPointerException in render
the jsp systems i know about take great pains to prevent you from doing response.getOutputStream(), having done the equivalent Writer thing for the jsp page already. you've commented out the response stuff in your code, and i guess it's after your null pointer problem anyway. but you may have use uit.toString() eventually. have you tried driver = new Driver(InputSource, OutputStream) ... driver.run() Raf Geusens wrote: Hi everybody, I started using Fop today, because I need it urgently for a project, but I've got some trouble running my first piece of code in it. This is the most important part of code, it's part of a jsp-page. The application always gives at NullPointerException error when it reaches driver.render(...). First I tought one of the parameters was null, but when I wrote them to the browser they seemed to be fine ([EMAIL PROTECTED] you know). I also wrote the other parameters like driver, file etc... to the browser and none of them is equal to null. So, what can be the solution to my NullPointerException, any ideas anyone? try { XSLTInputHandler input = new XSLTInputHandler(new File(file),new File (props.getString("pdfFase"))); ByteArrayOutputStream uit = new ByteArrayOutputStream(); response.setContentType("application/pdf"); Driver driver = new Driver(); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(uit); driver.render(input.getParser(), input.getInputSource()); /*byte [] content = uit.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush();*/ } catch (Exception e) { %><%= e %><% e.printStackTrace(); } Greetings, Raf _ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com
Re: VS: Pipe XSLT Transform to FOP (AND: ABOUT MAIL ARCHIVES)
Re SAXResult - wonderful! I didn't realize you could do this and had been very bothered by the size of the intermediate xsl:fo goo. I had even gotten to the point of hacking Tomcat and the servlet API to support threading and pipes between tags, only to find that Java pipes are fundamentally flawed (or broken, depending on your point of view). Amazing and quite unforgivable given that Java comes from a Unix company. And the Tomcat servlet filtering API is also fundamentally (and surprisingly) based on single-threading and buffers. Very disappointing. So three cheers for SAX pipelining for Fop! Oh, and BTW in another context I have timed using DOM trees vs XML strings as intermediate data to feed Xalan, and there was no difference that I could measure. May DOM disappear from the face of the earth. Joerg Pietschmann wrote: [EMAIL PROTECTED] wrote: some comments to Joergs message: I do not think using TraxInputHandler or XSLTInputHandler is better than using a DOM tree. Just for clarification: i did not recommend temporary files over intermediate DOM trees. I recommend a SAX event stream over any of temporary files, intermediate in-memory buffers for serialized XML or intermediate DOM trees. A DOM tree is often still preferable over some serialization because of performance (no reparsing) but not necessarily because of memory consumtion (depends on the implementation).
markers
does fop support markers? i'm having trouble getting them to work. my input looks like ... chapter one ... chapter two ... note that the markers share a common great-grandparent. the error message i get from any fop-0.20.[23] is: [ERROR]: fo:marker must be an initial child,and 'marker-class-name' must be unique for same parent. i'm following all the rules, i think, but no joy. sounds like a simple misconception on my part but i'm stumped.
Re: markers
Hey you forgot removed PNG support ;-) is this because of the jimi license problem? hey maybe there's a freeware imaging package that isn't so insistent on OutputStreams? i hate having to convert bytes to chars for use in JSP.
Re: : XML -> MS Word??
exactly how ghastly are you talking here? is the format [snort] published anywhere? Michiel Verhoef wrote: To top all: it is even quite simple. For a project we had to produce MS Excel files fromXML, using XSLT. As we didn't have a clue about Microsoft formats etc we figured: why not produce this ghastly MS-HTML and see what that does for us?
Re: : XML -> MS Word??
i agree - all *i* want to know about from this is what sort of xml i can output that M$ word will buy. Carlos Araya wrote: Michiel: Wouldn't it be easier to translate the xml to a CSV (comma separated value) file, import that into Excel and then finish up the formating? I wouldn't even bother trying the MS_HTML option Carlos On 03/04/02 8:36, "Bart Locanthi" <[EMAIL PROTECTED]> wrote: exactly how ghastly are you talking here? is the format [snort] published anywhere? Michiel Verhoef wrote: To top all: it is even quite simple. For a project we had to produce MS Excel files fromXML, using XSLT. As we didn't have a clue about Microsoft formats etc we figured: why not produce this ghastly MS-HTML and see what that does for us?
Re: Fop Multithreading.
threading isn't going to reduce the amount of cpu time it takes to do anything. in fact, if you have the misfortune to use PipedInputStreams, you will find dead time with each stage of your pipeline. an amazing gaffe for a unix company in their marquis language. Ramakrishnan.G wrote: Hai, I am using FOp to generate PDF and PS from xml and xsl. I runs very slow. Is it possible to thread the entire application after Driver class instantiation.