Take the 2-minute tour ×

The problem is simple, I want to transform a HTML text to plain text, thinks like putting line-breaks where is the <br> or title tags, number or markers on lists, etc.

I'm using BoilerPipe at the moment to do this, but this is not the main target of this library. There is another one that can do this?

share|improve this question
Good question, I've been using NekoHTML to get a DOM tree and then traverse all nodes, adding line breaks for <p>, <br> etc. Would be nice to find a well-tested library to do that. –  Martin Sep 5 '11 at 4:02
add comment

2 Answers

up vote 1 down vote accepted

I really like the java library for selenium. Use getBodyText() to get the plain body text with the html tags stripped out and properly formatted.


Selenium java API

share|improve this answer
add comment

How about using a XML parser? That way, you have control over the spacing and line breaks.

I doubt a full-fledged HTML parser and formatter would be available, since that runs into issues such as CSS parsing and all that stuff.

share|improve this answer
add comment

Your Answer


