|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cleancode.net.SimpleHtmlToText
public class SimpleHtmlToText
Converts an HTML document to text by stripping out all formatting tags and doing simple conversions. Tables are converted to use tabs and newlines (though nested tables may not appear correct). Multiple blanks are all removed on each line. Leading and trailing blanks are removed on each line. Multiple line breaks are removed. <HR> tags are printed as simple dividers (=============). Common HTML codes are converted to ASCII equivalents (&, ©, <, and >).
REConverter
Nested Class Summary | |
---|---|
static class |
SimpleHtmlToText.Test
A standalone test class. |
Field Summary | |
---|---|
static String |
VERSION
Current version of this class. |
Constructor Summary | |
---|---|
SimpleHtmlToText()
Construct a SimpleHtmlToText object. |
Method Summary | |
---|---|
String |
convert(String content)
Convert an HTML document (represented by a String) into text. |
String |
convert(String content,
boolean keepImages)
Convert an HTML document (represented by a String) into text, optionally keeping the image references. |
static void |
main(String[] args)
Main program for standalone mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VERSION
Constructor Detail |
---|
public SimpleHtmlToText()
Method Detail |
---|
public String convert(String content)
content
- a String representing the HTML document
public String convert(String content, boolean keepImages)
content
- a String representing the HTML documentkeepImages
- a boolean indicating to keep image file names in output
public static void main(String[] args) throws IOException
stdout
.
SimpleHtmlToText filename
args
- filename to convert
IOException
- if any problem reading file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
CleanCode Java Libraries | Copyright © 2001-2012 Michael Sorens - Revised 2012.12.10 |