0

I'm trying to write a simple tool that allows me to copy content from a web page, paste it into a JTextArea and convert it to HTML. Is there a way to do this? Are there libraries out there that will help? This would be similar to what Dreamweaver is able to do when you paste rendered HTML content into the Design area and it's converted back to HTML for you in the Code area.

webhound
  • 339
  • 1
  • 4
  • 13
  • 2
    What do you mean by _convert it to HTML_? A web page is usually mostly HTML. Do you mean you want to render the HTML? – Guillaume Polet Apr 26 '12 at 22:26
  • I think he means that in some GUI tools, like dreamweaver, you can copy in and it picks up metadata, like formatting and positioning, and can approximate that. This is not easily done, though there may be a library for it. Check the eclipse forums maybe? – Nathaniel Ford Apr 26 '12 at 22:35
  • Yes, what Nathaniel said. I guess it's like reverse rendering. – webhound Apr 26 '12 at 22:38
  • That is very basic rules. You will end up with only

    's and
    's

    – Sully Apr 26 '12 at 22:49

1 Answers1

1

Instead of using a jTextArea, you can use TinyMCE

This is a JavaScript wysiwig editor, that allows to edit HTML, and get a visual result of the code.

You can use wioth any server technology, because all the plumbing is done in the client side.

You can fully customize the toolbar, even making it completely invisible, so that it only gets the pasted html and shows it.

You can try it here

JotaBe
  • 38,030
  • 8
  • 98
  • 117