File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes converting xml into rtf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "converting xml into rtf " Watch "converting xml into rtf " New topic

converting xml into rtf

cogol tina

Joined: Oct 14, 2003
Posts: 3
I want to print a rtf document in java for which i have to convert an xml into rtf using style sheet. how can i do that.
don cline
Ranch Hand

Joined: Oct 10, 2003
Posts: 35
Things to check out -- for xml parsing - SAXParser (unless you prefer the DOM), for outputing rtf - javax.swing.text.rtf and the RTFEditorKit. I wrote a servlet years ago that converted an xml document to rtf, but that was before RTF support was built in to java. I was reading the RTF spec and building classes to output different parts of the RTF. I would not recommend that approach.
El Durango

Joined: Oct 09, 2003
Posts: 23
I've worked on converting XML to RTF, and so far the "cleanest" tool I can recommend to use is RFK (RTF Formatting Kit), however I still am not impressed with it since it has no support for Windows Drawing Objects used to make diagrams and other drawings. The other issue I had with it is that this tool does not come with an API, I had to write a script to access it and that becomes inconvenient at times.
Another thing that might be useful in the near future is XML FOP (XML Formatting Object Processor). This is being worked on by Apache XML group, however they still do not have RTF support, although they propose to have it. They will integrate JFor for the RTF support which to me is a tool in its embryonic stage. There may be other tools I may not be aware of but most of the ones I have come across are nothing to woo about. :roll:
Here are the links for the FOP project.
I agree. Here's the link:
subject: converting xml into rtf
It's not a secret anymore!