public final class HTMLTextTools
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log |
static java.util.regex.Pattern |
PATTERN_HTML_MESSAGE |
static java.util.regex.Pattern |
PATTERN_HTML_TAG |
static java.lang.String |
PATTERN_HTML_TAG_STRING
Matches all HTML Tags, with the tags name being in capture group 1.
|
Constructor and Description |
---|
HTMLTextTools() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertForHTMLInclusion(java.lang.String s)
Brings the given String _str in a form in which it may be included in
messages which are displayed as HTML (">html<...
|
static java.lang.String |
convertHTMLtoText(java.lang.String s)
Strips HTML Tags from a given text, removes all style elements and their content,
converts nonbreaking-space to regular, converts 'br' linebreaks to LF
|
static java.lang.String |
disableHTML(java.lang.String s)
This method replaces < and > in the given
String to prevent HTML-tags
from being interpreted by the browser... should be called prior to mlString2html(String) |
static java.lang.String |
replaceHtmlEntities(java.lang.String s)
Replaces (some) characters with special meaning in HTML with the
corresponding entities.
|
static java.lang.String |
stripHTML(java.lang.String s)
Strips all (possible) html-tags from the given text
|
static java.lang.String |
stripHTMLTags(java.lang.String inputString,
java.util.Collection<java.lang.String> rejected)
Strips all html tags from the given text, which occur in the provided Collection, ignores case.
|
static java.lang.String |
stripHTMLTagsExcept(java.lang.String inputString,
java.util.Collection<java.lang.String> allowed)
Strips all html tags from the given text, which do NOT occur in the provided Collection, ignores case.
|
public static final org.apache.log4j.Logger log
public static final java.lang.String PATTERN_HTML_TAG_STRING
public static final java.util.regex.Pattern PATTERN_HTML_TAG
public static final java.util.regex.Pattern PATTERN_HTML_MESSAGE
public static final java.lang.String convertForHTMLInclusion(java.lang.String s)
s
- string to convert for html inclusionpublic static final java.lang.String replaceHtmlEntities(java.lang.String s)
s
- Stringpublic static final java.lang.String disableHTML(java.lang.String s)
String
to prevent HTML-tags
from being interpreted by the browser... should be called prior to mlString2html(String)s
- the String
public static final java.lang.String stripHTML(java.lang.String s)
s
- the inputstringpublic static final java.lang.String convertHTMLtoText(java.lang.String s)
s
- the inputstring to replace, nullablepublic static final java.lang.String stripHTMLTags(java.lang.String inputString, java.util.Collection<java.lang.String> rejected)
inputString
- the String to process, nullablerejected
- a collection of strings which are interpreted as html tags which will be removed from s.
also removes any parameter this tag has.public static final java.lang.String stripHTMLTagsExcept(java.lang.String inputString, java.util.Collection<java.lang.String> allowed)
Note: If the Collection is null, nothing is stripped. Use Collections.emptyList() as parameter or stripHTML(String) to strip all Tags.
inputString
- the input text, nullableallowed
- a collection of strings, which are the html tags that will be kept in inputString.Copyright © 2000-2024 OAshi S.à r.l. All Rights Reserved.