Hey, Thanks for the suggestions. Yes I do generate the XML as a String. That's because we get back Data as Objects from the database via Hibernate. I then call a toXMLString() method on this Object to return get an XML String.
My XML knowledge is pretty rudimentary. So where would you suggest that I generate the XML using SAX/DOM. I've heard that the Digester does a pretty nifty job, do you suggest this? Any other? Thanks in Advance, Prabhat. -----Original Message----- From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 4:14 PM To: [EMAIL PROTECTED] Subject: Re: special characters Prabhat Kumar (IT) wrote: > I am having to escape special characters such as apostrophes (replace with > &apos) to get them to display correctly on PDFs. Is this really necessary? > > Basically What I do is, > > 1. Read Database. > 2. Generate XML for this data. > 2a. During this generation, replace characters such as apostrophes, quotes, > ampersands with ' " & respectively. > 3. Apply XSL-FO transormations to this XML 4. Write the > generated PDF's bytes to a the ServletOutputStream. > > Step 2a seems wasteful to me. Has anyone had to do this before? Is there a > better way? It depends. It seems you generate the XML as string. In this case you have always to escape the ampersand. The apostrophe and quote characters need only to be escaped in attribute values (and even then not always), there is no need to replace them in text content. You can look at generating a DOM, or SAX events. In this case you must not escape special XML characters, but this also means you can't store XML snippets with markup in your database. J.Pietschmann --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
