public class HtmlToPlainText extends Object
Note that this is a fairly simplistic formatter -- for real world use you'll want to embrace and extend.
To invoke from the command line, assuming you've downloaded the jsoup jar to
your current directory:
java -cp jsoup.jar org.jsoup.examples.HtmlToPlainText url [selector]
where url is the URL to fetch, and selector is an optional CSS
selector.
Constructor and Description |
---|
HtmlToPlainText() |
Modifier and Type | Method and Description |
---|---|
String |
getPlainText(org.jsoup.nodes.Element element)
Format an Element to plain-text
|
static void |
main(String... args) |
static String |
toPlainText(org.jsoup.nodes.Document document) |
static String |
toPlainText(org.jsoup.nodes.Element element) |
static String |
toPlainText(String html) |
public static void main(String... args) throws IOException
IOException
public String getPlainText(org.jsoup.nodes.Element element)
element
- the root element to formatpublic static String toPlainText(org.jsoup.nodes.Document document)
public static String toPlainText(org.jsoup.nodes.Element element)
Copyright © 2019 OpenEstate. All rights reserved.