Java HTML Parse Jsoup cleanHTML(final String html)

Here you can find the source of cleanHTML(final String html)

Description

Remove most unsafe tags and attributes, leaving mostly format tags and links.

License

Open Source License

Parameter

Parameter Description
html HTML to be cleaned.

Return

Clean HTML.

Declaration

public static String cleanHTML(final String html) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.jsoup.Jsoup;
import org.jsoup.safety.Whitelist;

public class Main {
    /**//  w ww .j a va  2 s .c om
     * Remove most unsafe tags and attributes, leaving mostly format tags and links.
     * 
     * @param html HTML to be cleaned.
     * @return Clean HTML.
     * 
     * @see Jsoup#clean(String, Whitelist)
     * @see Whitelist#basic()
     */
    public static String cleanHTML(final String html) {
        return html != null ? Jsoup.clean(html, Whitelist.basic()) : null;
    }
}

Related

  1. br2nl(String html)
  2. clean(String html)
  3. clean(String html, Whitelist whitelist)
  4. cleanHtmlCode(String html)
  5. cleanHtmlFromString(String stringToClean)
  6. cleanHTMLTags(String str)
  7. cleanupHtmlDoc(String s)