Package org.opencms.util
Class CmsHtmlConverterJTidy
- java.lang.Object
-
- org.opencms.util.A_CmsHtmlConverter
-
- org.opencms.util.CmsHtmlConverterJTidy
-
- All Implemented Interfaces:
I_CmsHtmlConverter
public class CmsHtmlConverterJTidy extends A_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
Constructors Constructor Description CmsHtmlConverterJTidy()
Constructor, creates a new CmsHtmlConverterJTidy.CmsHtmlConverterJTidy(java.lang.String encoding, java.util.List<java.lang.String> modes)
Constructor, creates a new CmsHtmlConverterJTidy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
convertToString(java.lang.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 Detail
-
CmsHtmlConverterJTidy
public CmsHtmlConverterJTidy()
Constructor, creates a new CmsHtmlConverterJTidy.
-
CmsHtmlConverterJTidy
public CmsHtmlConverterJTidy(java.lang.String encoding, java.util.List<java.lang.String> modes)
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 Detail
-
convertToString
public java.lang.String convertToString(java.lang.String htmlInput) throws java.io.UnsupportedEncodingException
Converts the given HTML code according to the settings of this converter.- Specified by:
convertToString
in interfaceI_CmsHtmlConverter
- Specified by:
convertToString
in classA_CmsHtmlConverter
- Parameters:
htmlInput
- HTML input stored in a string- Returns:
- string containing the converted HTML
- Throws:
java.io.UnsupportedEncodingException
- if the encoding set for the conversion is not supported- See Also:
I_CmsHtmlConverter.convertToString(java.lang.String)
-
-