RE: parsing package
Glen Mazza wrote: --- Victor Mote [EMAIL PROTECTED] wrote: Glen, what are your plans for apps/FOInputHandler? Will it be going away or get renamed anyway? I have been using Handler as related to SAX events, and it looks like we have it also being used as I/O in a more raw form. Here's my thoughts on this (all seven of them!): 1) I'm not a big fan of the renaming because StructureHandler is not used for all possible render types. Calling it FOInputHandler seems to imply that Hmmm. I must be missing something. What render types is it not used for? It is an abstract class that is subclassed by both the renderers that produce an area tree (PDF, Postscript), and by the Structure Renderers (RTF, MIF). In other words, it is used (I think) by anything that needs to parse an FO document for input (hence its name). it's used whenever you are requesting an FO Tree to be built, i.e., always. I didn't mind StructureHandler, but maybe FormattedHandler is also OK. Actually it *is* used every time you are requesting an FO Tree to be built, and in fact it is used for additional cases where an FO Tree is not built, such as the Structure Renderers. That is what was driving me crazy -- I couldn't figure out how LayoutHandler was a subclass of StructureHandler !!??!! Now, one of the subclasses, FOTreeHandler (formerly LayoutHandler), *is* used only by those renderers that actually need to build and use an FO tree. On the StructureHandler vs. FormattedHandler issue, AFAIK, the two concepts are *opposites* in FOP's terminology. I might need to start a glossary page to document this, so that we have a point of reference. Structure implies an output format that is like XSL-FO in its character, i.e. it describes general formatting properties, but doesn't do any layout. The two that we support right now are RTF MIF. The whole point of the renaming is that it is used for much more than Structure. Browsing through my SAX2 book just now gave me a bit of inspiration. It breaks the SAX API into two pieces -- producers and consumers, which makes sense. This is useful because the apps stuff (InputHandler and its concrete subclasses) are producers, and the stuff I am working with in fo is consumers. The book seems to equate handler with consumer, which is the same way I have been treating it. So maybe our apps classes would be better named InputProducer, XSLTInputProducer, etc. I hate to get too hung up on the naming stuff, but I spent about six hours of mind-numbing catatonic thrashing yesterday figuring out that StructureHandler had nothing to do with our concept of Structure, so I think it is worth some investment. In all honesty, on your other 6 points my eyes glazed over. You are much better educated than I about what is going on in that part of the code. To conserve my limited bandwidth, I'll have to ignore it until I feel some pain from there. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: default value of force param for FOP
From: Glen Mazza [EMAIL PROTECTED] snip/ (a) Don't include force patch at all -- only have this option for 1.0. Argument for this: Haven't had too many requests for it, we can continue as-is until 1.0. Since no one else has answered I hope you dont object to me posting an opinion. I would tend to agree with (a) over the others because no one is screaming for this and since no further releases of maintenance branch are planned, the benefit of including it there would be limited. snip/ Chris _ Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: parsing package
Victor-- After looking over the new design, I like it. Please keep your FOInputHandler abstract base class as-named. FOTreeHandler also is a very good name. I'd like to keep, however, at least for the time being, the naming convention in fop.apps with InputHandler as well. It's the command line input handler in apps, just like your abstract class is in apps.fo. If/when they start to conflict, we'll come up with better names in the apps package--I just don't want to come up with an incomplete name right now. Thanks, Glen __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21420] - [PATCH] Support for CMYK JPGs broken
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21420. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21420 [PATCH] Support for CMYK JPGs broken --- Additional Comments From [EMAIL PROTECTED] 2003-07-30 20:23 --- Thanks for applying the patch! Let me know when you're ready to revisit this for the trunk code; I'll be happy to write a new patch. Or better yet, I'll just do it when the first milestone trunk version is released. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/tools/anttasks Fop.java
gmazza 2003/07/30 15:01:35 Modified:src/documentation/content/xdocs anttask.xml src/java/org/apache/fop/tools/anttasks Fop.java Log: Patch 21381: New force attribute added to FOP task, update to documentation. Submitted by: Sean Gilligan (seanlist at msgilligan dot com) Revision ChangesPath 1.5 +5 -0 xml-fop/src/documentation/content/xdocs/anttask.xml Index: anttask.xml === RCS file: /home/cvs/xml-fop/src/documentation/content/xdocs/anttask.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- anttask.xml 27 Jul 2003 17:59:36 - 1.4 +++ anttask.xml 30 Jul 2003 22:01:35 - 1.5 @@ -68,6 +68,11 @@ tdOutput directory/td tdRequired if a fileset is used to specify the files to render; optional for fofile. (Can alternatively specify the full path in the fofile value.)/td /tr + !--tr Commented out; implemented only in 1.0 currently + tdforce/td + tdIf codetrue/code, always generate target file, even if source file has not changed./td + tdNo, default is codefalse/code/td + /tr-- !--tr Commented out; attribute is currently unimplemented according to the code tdbasedir/td tdDirectory to work from/td 1.6 +50 -7 xml-fop/src/java/org/apache/fop/tools/anttasks/Fop.java Index: Fop.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/tools/anttasks/Fop.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Fop.java 27 Jul 2003 16:37:14 - 1.5 +++ Fop.java 30 Jul 2003 22:01:35 - 1.6 @@ -104,6 +104,7 @@ private File userConfig; private int messageType = Project.MSG_VERBOSE; private boolean logFiles = true; +private boolean force = false; /** * Sets the filename for the userconfig.xml. @@ -154,6 +155,24 @@ } /** + * Set whether to check dependencies, or to always generate; + * optional, default is false. + * + * @param force true if always generate. + */ +public void setForce(boolean force) { +this.force = force; +} + +/** + * Gets the force attribute + * @return the force attribute + */ +public boolean getForce() { +return force; +} + +/** * Sets the output file. * @param outFile File to output to */ @@ -265,7 +284,7 @@ public boolean getLogFiles() { return this.logFiles; } - + /** * @see org.apache.tools.ant.Task#execute() */ @@ -395,7 +414,10 @@ int rint = determineRenderer(task.getFormat()); String newExtension = determineExtension(rint); +// actioncount = # of fofiles actually processed through FOP int actioncount = 0; +// skippedcount = # of fofiles which haven't changed (force = false) +int skippedcount = 0; // deal with single source file if (task.getFofile() != null) { @@ -407,8 +429,17 @@ if (task.getOutdir() != null) { outf = new File(task.getOutdir(), outf.getName()); } -render(task.getFofile(), outf, rint); -actioncount++; + +// Render if force flag is set OR +// OR output file doesn't exist OR +// output file is older than input file +if (task.getForce() || !outf.exists() +|| (task.getFofile().lastModified() outf.lastModified() )) { +render(task.getFofile(), outf, rint); +actioncount++; +} else if (outf.exists() (task.getFofile().lastModified() = outf.lastModified() )) { +skippedcount++; +} } } @@ -446,14 +477,26 @@ task.log(Error setting base URL, Project.MSG_DEBUG); } -render(f, outf, rint); -actioncount++; +// Render if force flag is set OR +// OR output file doesn't exist OR +// output file is older than input file +if (task.getForce() || !outf.exists() +|| (f.lastModified() outf.lastModified() )) { +render(f, outf, rint); +actioncount++; +} else if (outf.exists() (f.lastModified() = outf.lastModified() )) { +skippedcount++; +} } } - -if (actioncount ==
cvs commit: xml-fop/src/java/org/apache/fop/apps XSLTInputHandler.java TraxInputHandler.java
gmazza 2003/07/30 22:14:29 Modified:src/java/org/apache/fop/apps XSLTInputHandler.java Removed: src/java/org/apache/fop/apps TraxInputHandler.java Log: XSLTInputHandler reimplemented using TraxInputHandler code. TraxInputHandler removed. (Retaining XSLTInputHandler because of its technology-independent name, also probably the more used class of the two.) Revision ChangesPath 1.6 +95 -14xml-fop/src/java/org/apache/fop/apps/XSLTInputHandler.java Index: XSLTInputHandler.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/XSLTInputHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- XSLTInputHandler.java 17 Jun 2003 16:35:57 - 1.5 +++ XSLTInputHandler.java 31 Jul 2003 05:14:29 - 1.6 @@ -53,9 +53,19 @@ // Imported java.io classes import java.io.File; +// Imported TraX classes +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.sax.SAXTransformerFactory; + // Imported SAX classes import org.xml.sax.InputSource; import org.xml.sax.XMLReader; +import org.xml.sax.XMLFilter; /** * XSLTInputHandler basically takes an XML file and transforms it with an XSLT @@ -63,7 +73,9 @@ */ public class XSLTInputHandler extends InputHandler { -private TraxInputHandler traxInputHandler; +private Transformer transformer; +private StreamSource xmlSource; +private Source xsltSource; /** * Constructor for files as input @@ -72,7 +84,9 @@ * @throws FOPException if initializing the Transformer fails */ public XSLTInputHandler(File xmlfile, File xsltfile) throws FOPException { -this.traxInputHandler = new TraxInputHandler(xmlfile, xsltfile); +this.xmlSource = new StreamSource(xmlfile); +this.xsltSource = new StreamSource(xsltfile); +initTransformer(); } /** @@ -82,7 +96,9 @@ * @throws FOPException if initializing the Transformer fails */ public XSLTInputHandler(String xmlURL, String xsltURL) throws FOPException { -traxInputHandler = new TraxInputHandler(xmlURL, xsltURL); +this.xmlSource = new StreamSource(xmlURL); +this.xsltSource = new StreamSource(xsltURL); +initTransformer(); } /** @@ -93,32 +109,98 @@ */ public XSLTInputHandler(InputSource xmlSource, InputSource xsltSource) throws FOPException { -traxInputHandler = new TraxInputHandler(xmlSource, xsltSource); +this.xmlSource = new StreamSource(xmlSource.getByteStream(), + xmlSource.getSystemId()); +this.xsltSource = new StreamSource(xsltSource.getByteStream(), + xsltSource.getSystemId()); +initTransformer(); +} + +private void initTransformer() throws FOPException { +try { +this.transformer = +TransformerFactory.newInstance().newTransformer(xsltSource); +} catch (Exception ex) { +throw new FOPException(ex); +} } /** - * Get the InputSource. - * @return the InputSource - * @deprecated Use TraxInputHandler run(Driver driver) instead. + * @see org.apache.fop.apps.InputHandler#getInputSource() */ public InputSource getInputSource() { -return traxInputHandler.getInputSource(); +InputSource is = new InputSource(); +is.setByteStream(xmlSource.getInputStream()); +is.setSystemId(xmlSource.getSystemId()); +return is; } /** - * Get the parser, actually an XML filter. + * Overwrites this method of the super class and returns an XMLFilter + * instead of a simple XMLReader which allows chaining of transformations. * @see org.apache.fop.apps.InputHandler#getParser() - * @deprecated Use TraxInputHandler run(Driver driver) instead. */ public XMLReader getParser() throws FOPException { -return traxInputHandler.getParser(); +return getXMLFilter(xsltSource); +} + +/** + * Creates from the transformer an instance of an XMLFilter which + * then can be used in a chain with the XMLReader passed to Driver. This way + * during the conversion of the xml file + xslt stylesheet the resulting + * data is fed into Fop. This should help to avoid memory problems + * @param xsltSource An xslt stylesheet + * @return an