user63898
user63898

Reputation: 30895

java parse html + css and convert the output to different lang

i need to understand html + css files and convert it to somthing like rtf layot in java now i understand i need somekind of html parser but what i need to do from there ? how can i implement html-css convertor ? is there somekind of patern or method for such jobs?

Upvotes: 0

Views: 1060

Answers (3)

Tim Büthe
Tim Büthe

Reputation: 63734

There is the The Flying Saucer Project that let you render XHTML to PDF. Maybe that could be used instead of RTF or the resulting PDF could be converted to RTF?

Upvotes: 0

Daniel Hiller
Daniel Hiller

Reputation: 3485

I'd do the following:

  1. At first use JTidy to convert HTML to valid XHTML
  2. Apply an XSLT to convert to RTF using an XML library like Saxon or Xerces

Note: although I didn't find an xsl file for that conversion directly I'm sure there is one anywhere

Upvotes: 1

Kathy Van Stone
Kathy Van Stone

Reputation: 26271

You should check out HTMLEditorKit. It provides some support for CSS rendering. There is also an RTFEditorKit for writing, although it is not entirely reliable (last I checked, several years ago).

Is there a reason you need to use Java instead of just loading the HTML in Word (or some other editor) and saving it as RTF? Also check this W3C link.

Upvotes: 1

Related Questions