Package org.opencms.util
Class CmsHtmlConverterJTidy
java.lang.Object
org.opencms.util.A_CmsHtmlConverter
org.opencms.util.CmsHtmlConverterJTidy
- All Implemented Interfaces:
I_CmsHtmlConverter
HTML cleaner and pretty printer using JTidy.
Used to clean up HTML code (e.g. remove word tags) and optionally create XHTML from HTML.
- Since:
- 6.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor, creates a new CmsHtmlConverterJTidy.CmsHtmlConverterJTidy(String encoding, List<String> modes) Constructor, creates a new CmsHtmlConverterJTidy. -
Method Summary
Modifier and TypeMethodDescriptionconvertToString(String htmlInput) Converts the given HTML code according to the settings of this converter.Methods inherited from class org.opencms.util.A_CmsHtmlConverter
getEncoding, getModes, init
-
Constructor Details
-
CmsHtmlConverterJTidy
public CmsHtmlConverterJTidy()Constructor, creates a new CmsHtmlConverterJTidy. -
CmsHtmlConverterJTidy
Constructor, creates a new CmsHtmlConverterJTidy.Possible values for the conversion mode are:
CmsHtmlConverter.PARAM_DISABLED: The conversion is disabled.CmsHtmlConverter.PARAM_ENABLED: Conversion is enabled without transformation, so HTML is pretty printed only.CmsHtmlConverter.PARAM_XHTML: Conversion from HTML to XHTML is enabled.CmsHtmlConverter.PARAM_WORD: Cleanup of word like HTML tags is enabled.CmsHtmlConverter.PARAM_REPLACE_PARAGRAPHS: Cleanup of paragraphs and leading/trailing line breaks is enabled.
- Parameters:
encoding- the encoding used for the HTML code conversionmodes- the conversion modes to use
-
-
Method Details
-
convertToString
Converts the given HTML code according to the settings of this converter.- Specified by:
convertToStringin interfaceI_CmsHtmlConverter- Specified by:
convertToStringin classA_CmsHtmlConverter- Parameters:
htmlInput- HTML input stored in a string- Returns:
- string containing the converted HTML
- Throws:
UnsupportedEncodingException- if the encoding set for the conversion is not supported- See Also:
-