On Mon, Apr 23, 2012 at 1:02 PM, jerem <[email protected]> wrote:
I'm trying to convert HTML content to plain text. The background is that it's used in the Mail Archive app I'm writing, to provide indexable content in mail pages when only html is provided - html content being zipped, it's not indexable. I just convert the html to plain text and store it. Works great from scripting API but now I'm trying to reproduce inside Java component.
In that case it would probably be better to use the StreamParser which does not create a XDOM and directly provide events to the renderer. Here is an example that would probably help you: look at fromHTML in https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwik... That's what the WYSIWYG use to convert its HTML content to wiki content when saving. In you case instead of a provided wiki syntax you would use "plain/1.0". Note that you can directly use "html/4.01" stream parser instead of executing yourself the HTMLCleaner.
-- View this message in context: http://xwiki.475771.n2.nabble.com/How-to-call-rendering-component-tp7487904p... Sent from the XWiki- Dev mailing list archive at Nabble.com. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne