Java HTML Parse Jsoup getPlainText(String htmlText)

Here you can find the source of getPlainText(String htmlText)

Description

Turn a hunk of text that contains HTML into plaintext.

License

Apache License

Parameter

Parameter Description
htmlText the HTML text to massage

Return

the text of the HTML

Declaration

public static String getPlainText(String htmlText) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class Main {
    /**/*from ww w. ja  v a2  s  .  c  o  m*/
     * Turn a hunk of text that contains HTML into plaintext.
     * @param htmlText the HTML text to massage
     * @return the text of the HTML
     */
    public static String getPlainText(String htmlText) {
        Document d = Jsoup.parse(htmlText);
        return d.text();
    }
}

Related

  1. getHtmlBodyContent(String html)
  2. getHtmlInTag(String html, String tag)
  3. getImageCredit(String html)
  4. getJSFileLinks(String html)
  5. getMetaValue(String html, String metaKey)
  6. getPlainTextFromHtml(String html)
  7. getTitle(String htmlContent)
  8. htmlArray2textArray(List htmlArray)
  9. isHTMLEmpty(String textToCheck)