Re: namespace-prefixes
At 8:53 PM +0100 3/5/04, Simon Pepping wrote: It took me a little while, but I now remember again why I did not want to use the XMLReaderFactory. I do not understand how I can guarantee that I get an XMLReader that is capable of validation. In SAXParserFactory I can configure the factory to look for a validating and namespace-aware parser. In XMLReaderFactory, it may produce an XMLReader which throws an exception when I want to set the validating feature on it. This is a new one for me, and I can see how you might think SAXParserFactory guarantees validation by looking at the API docs, but it isn't true. SAXParserFactory can indeed give you a parser that does not support validation. If you ask for validation, and a validating parser isn't available, then you'll get an exception, just as you would if you tried to set validation on an XMLReader returned by XMLReaderFactory that did not support validation. Most SAXParserFactory users have installed implementations that default to Crimson, Oracle, or Xerces, all of which validate, so they never notice this. The only way to be sure to get validation is to request a known validating parser such as Xerces by name, and it's much easier to request a known parser with XMLReaderFactory than with SAXParserFactory. The latter requires you to muck with system properties and the services API, and never be to sure whether the user is going to throw some other jar file in the mix that overrides your carefully constructed code. I remain amazed at what developers believe about SAXParserFactory that just isn't true, and what magical properties they attribute to it. I really am curious to know how these ideas took hold in the community. Possibly there was a crucial book or tutorial at some point that promulgated these mistaken ideas that I just haven't read. You know, now that I think about it that way I have a funny feeling I may know which book that was, but I'll have to wait till I get to my office on Tuesday to check. -- Elliotte Rusty Harold [EMAIL PROTECTED] Effective XML (Addison-Wesley, 2003) http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
Re: namespace-prefixes
By the way, if you're curious you can look at the code for SAXParserFactory (and its default concrete subclass in Java 1.4) in the Apache Crimson CVS (which is ungodly slow today, not sure why). It's easy to see that it never returns any parser other than Crimson, regardless of what features you ask for. Of course, other implementations like Xerces will return different defaults. But the SAXParserFactory will not iterate through all installed parsers looking for one that satisfies all the requested features. I suppose you can imagine one that does that, but I've never seen one like that, and the one in Java 1.4 certainly doesn't do that. What's really strange though is that when you try to set a feature on the factory, then the factory actually creates an XMLReader to see if an exception is thrown, and then throws the reader away! In other words. SAXParserFactory.setFeature() invokes XMLReader.setFeature()! The SAXParserFactory doesn't even know what features it can support until the XMLReader tells it! Talk about a hack. Check it out for yourself: http://cvs.apache.org/viewcvs.cgi/xml-crimson/src/org/apache/crimson/jaxp/ -- Elliotte Rusty Harold [EMAIL PROTECTED] Effective XML (Addison-Wesley, 2003) http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
Re: namespace-prefixes
At 12:56 PM +1000 3/4/04, Peter B. West wrote: Fops, In HEAD, ///apps/FOFileHAndler.java contains the following: protected static XMLReader createParser() throws FOPException { try { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.setFeature( http://xml.org/sax/features/namespace-prefixes;, true); return factory.newSAXParser().getXMLReader(); } catch (SAXNotSupportedException se) { throw new FOPException(Error: You need a parser which allows the + http://xml.org/sax/features/namespace-prefixes; + feature to be set to true to support namespaces, se); I would be inclined to modify that to: protected static XMLReader createParser() throws FOPException { try { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); return factory.newSAXParser().getXMLReader(); } catch (SAXNotSupportedException se) { throw new FOPException(Error: You need a parser which allows the + http://xml.org/sax/features/namespaces; + feature to be set to true to support namespaces, se); What I ask on reading this code is why you're using SAXParserFactory at all? SAXParserFactory is a Sun class they invented to fill a hole in SAX 1.0. It's unnecessary in SAX 2.0. SAX2 apps should use XMLReaderFactory instead, which has the correct defaults you want in the first place. It would look something like this: protected static XMLReader createParser() throws FOPException { try { XMLReader parser = XMLReaderFactory.createXMLReader(); return parser; } catch (SAXException se) { throw new FOPException(Could not find a parser. Make sure the + system property is set); } } That's off the top of my head so it may not compile, and there are ways to look for alternative parsers if you don't find one immediately (See http://www.cafeconleche.org/books/xmljava/chapters/ch07.html#d0e9994 ) but you get the idea. -- Elliotte Rusty Harold [EMAIL PROTECTED] Effective XML (Addison-Wesley, 2003) http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
Re: namespace-prefixes
At 2:36 PM -0800 3/4/04, Glen Mazza wrote: --- Elliotte Rusty Harold [EMAIL PROTECTED] wrote: What I ask on reading this code is why you're using SAXParserFactory at all? SAXParserFactory is a Sun class they invented to fill a hole in SAX 1.0. It's unnecessary in SAX 2.0. SAX2 apps should use XMLReaderFactory instead, which has the correct defaults you want in the first place. It would look something like this: Mr. Harold, Pardon my ignorance here--but do the Xalan libraries that ship with the 1.4 JDK handle SAX 2.0? Yes, they absolutely do. If you're using namespaces, XMLReader, ContentHandler, and so forth (and you really have to be for XSL) then you are already using SAX 2. The Xalan home page [1] is ambiguous on their support of it, and I'm concerned if there would be compatability problems if we were to use it. I'm not quite sure what you're seeing on that page that concerns you, but I don't see anything there that should prevent you from using XMLReaderFactory. -- Elliotte Rusty Harold [EMAIL PROTECTED] Effective XML (Addison-Wesley, 2003) http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
Re: namespace-prefixes
At 10:43 AM +1000 3/5/04, Peter B. West wrote: I think this might be because the HEAD developers were moving to a JAXP implementation, and SAXParserFactory is still in the 1.4 javax.xml.parsers package, which, AIUI, is what one is supposed to use for JAXP-compatible applications. I don't know much about JAXP, so this could be wrong. It's a common misconception, but it is very much a misconception. I don't know how this meme got started, but it is annoyingly persistent; and it causes people all sorts of trouble. SAXParserFactory should not be used in 2004. It does not replace XMLReaderFactory. In fact, the opposite is true. XMLReaderFactory replaces SAXParserFactory. The only reason SAXParserFactory exists is to support SAX 1.0. It is underspecified and has completely wrong defaults for handling namespaces or SAX 2. Honestly Sun should never have released it in the first place. By the time they released JAXP 1.0, SAX 2.0 was in late beta, just weeks from release, and was obviously going to render JAXP 1.0 obsolete; but Sun went ahead anyway, and thoroughly confused the market. Not invented here syndrome, I think. They simply were not willing to accept a process they didn't control. Four years later the rest of us are still paying the price for their hubris. :-( -- Elliotte Rusty Harold [EMAIL PROTECTED] Effective XML (Addison-Wesley, 2003) http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
XSL-FO, Chapter 18 of the XML Bible, has been updated
I'm happy to announce that I've posted an updated version of Chapter 18 of the XML Bible, XSL Formatting Objects, at Cafe con Leche: http://www.cafeconleche.org/books/bible2/chapters/ch18.html This is the complete chapter, approximately 70 pages with many full examples of XSL-FO. Everything should now be up-to-date with the November 2001 Recommmendation of the XSL-FO specification and FOP 0.20.4. Mostly the changes were fairly minor, just changing the master-name attribute to the master-reference attribute on about four elements. I also updated the FOP coverage to version 0.20.4, and fixed a few minor errors where I noticed them. -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | XML in a Nutshell, 2nd Edition (O'Reilly, 2002) | | http://www.cafeconleche.org/books/xian2/ | | http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/| +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Build problems Could not read filters from file:
I'm trying to compile FOP 0.20.3 to add PMG support through JIMI. However, all builds keep dying like this: BUILD FAILED J:\fop-0.20.3\build.xml:293: Could not read filters from file: J:\fop-0.20.3\build\src\codegen\filter This is not just regular bulds but build clean and so forht too. Any suggestions? -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (IDG Books, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: pdf bean
Hello, Somewhat off topic, but since this shapes up as the largest collective body of pdf-ers outside of Adobe, I hope not to offend. Anyone know of a pdf-rendering components (java) ? see http://www.pdfgo.com/products.html for a $449 payware product that will do this, or try Google -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/| +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: 0.20.3rc bug
Hello all, I have not posted any bugs before and don't really know the formal procedure yet, and I haven't seen this brought up by anyone else either. I have a stylesheet which produces an fo file with two fo:page-sequences. It produces pdf's correctly with version =0.20.2rc. With 0.20.3.rc it produces the message: master-reference for fo:page-sequence matches no simple-page-master or page-sequence-master It seems that there is something wrong with the new version since I clearly have two page-sequence-master s with the same names as the two page-sequences. No. There is something wrong with your stylesheet. Specifically, you are using the syntax from the XSL Proposed Recommednation rather than the syntax from the XSL 1.0 Recommmendation. The name of this attribute changed between the two. 0.20.3 supports the final syntax, not the earlier draft syntax. YOu need to change a master-name attribute to a master-reference attribute on the fo:page-sequence. -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.ibiblio.org/xml/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: [ANNOUNCEMENT] FOP 0.20.3 Release Candidate available
At 1:32 PM +0100 1/22/02, Christian Geisert wrote: Hi all, the Release Candidate for 0.20.3 (Maintenance release) is finally available at http://xml.apache.org/dist/fop for downloading and testing. Cool! Since this is labeled a Release Candidate is there actually plan to make this a release at some point? 0.20.2 never got beyond release candidate. -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.ibiblio.org/xml/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FOP conformance
At 1:19 PM -0400 11/30/01, Arved Sandstrom wrote: As regards the topic in general, I support Keiron 100%. The entire point of the rewrite is that during the process things are in limbo...this was well understood before, or so I thought. It was understood. However, there was an implicit assumption that XSL-FO was stable enough that FOP 0.20-2 would continue to work as well as it ever had. When XSL 1.0 was released, that assumption proved to be false. That's not the fault of anybody here, just life on the bleeding edge. As other projects like DocBook start upgrading their stylesheets to support the final XSL 1.0 recommendation, then FOP stops working where it worked before. This means users need to make a decision between supporting the tools that work with XSL 1.0 and FOP. Nobody here anticipated this. Note that I am specifically talking about the change from the master-name to master-reference attribute, not the various other patches that have been submitted to 0.20-2. While useful, those patches aren't as important. The master-name/master-reference affects all XSL-FO documents, and means that FOP is totally non-functional. This is not a case of not supporting this feature in these stylesheets or that feature in those stylesheets. FOP will not produce any output when presented with an XSL 1.0 stylesheet. It cannot be used. -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.ibiblio.org/xml/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: XSL-FO Engine comparisons
At 10:28 PM +0100 7/31/01, Sebastian Rahtz wrote: Elliotte Rusty Harold writes: The downside to this otherwise excellent engine is that it's Windows only and based on Windows graphics primitives rather than PostScript or PDF. It displays on the screen very nicely, and prints nicely too. However, it does not produce a PDF document that I can send to my editor or a typesetter. Cant you print PS to file and Distill it? I suppose I could, but only if somebody knows of an open source tool for distilling files. After the Skylarov fiasco, I'll be damned if I'm going to give Adobe one more penny. Hmm, after a little hunting around with Google it looks like GhostScript might actually do that. I'll have to give it a try. -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.ibiblio.org/xml/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: XSL-FO Engine comparisons
At 7:19 PM +0200 7/31/01, Petr Andrs wrote: I think there is other reason for formatters beeing not production redy as well. This reason is that XSL FO is only in CR state of its first version. I think 1.1 or 2.0 XSL FO Recomendation will be far better. I don't think that's it. I haven't found any cases where XSL FO was insufficiently expressive for my needs (essentially laying out a computer book). There've been a couple of cases where Docbook was insufficiently expressive, but there are workarounds for that. The problems I encountered were all in implementation, not in the language. A new version of XSLFO wouldn't really help me any. -- +---++---+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +---++---+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.ibiblio.org/xml/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +--+-+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]