public class CmsHtmlConverter
extends java.lang.Object
implements java.io.Serializable
Used to clean up html code (e.g. remove word tags) and optionally create xhtml from html.
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
PARAM_DISABLED
Param value for disabled mode.
|
static java.lang.String |
PARAM_ENABLED
Param value for enabled mode.
|
static java.lang.String |
PARAM_WORD
Param value for WORD mode.
|
static java.lang.String |
PARAM_XHTML
Param value for XHTML mode.
|
| 构造器和说明 |
|---|
CmsHtmlConverter()
Constructor, creates a new CmsHtmlConverter.
|
CmsHtmlConverter(java.lang.String encoding,
java.lang.String mode)
Constructor, creates a new CmsHtmlConverter.
|
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
convertToByte(byte[] htmlInput)
Converts the given html code according to the settings of this converter.
|
byte[] |
convertToByte(java.lang.String htmlInput)
Converts the given html code according to the settings of this converter.
|
byte[] |
convertToByteSilent(byte[] htmlInput)
Converts the given html code according to the settings of this converter.
|
byte[] |
convertToByteSilent(java.lang.String htmlInput)
Converts the given html code according to the settings of this converter.
|
java.lang.String |
convertToString(byte[] htmlInput)
Converts the given html code according to the settings of this converter.
|
java.lang.String |
convertToString(java.lang.String htmlInput)
Converts the given html code according to the settings of this converter.
|
java.lang.String |
convertToStringSilent(byte[] htmlInput)
Converts the given html code according to the settings of this converter.
|
java.lang.String |
convertToStringSilent(java.lang.String htmlInput)
Converts the given html code according to the settings of this converter.
|
java.lang.String |
getEncoding()
Returns the encoding used for the html code conversion.
|
static boolean |
isConversionEnabled(java.lang.String conversionMode)
Tests if the content conversion is enabled.
|
static void |
main(java.lang.String[] args) |
public static final java.lang.String PARAM_DISABLED
public static final java.lang.String PARAM_ENABLED
public static final java.lang.String PARAM_WORD
public static final java.lang.String PARAM_XHTML
public CmsHtmlConverter()
The encoding used by default is CmsEncoder.ENCODING_UTF_8.
public CmsHtmlConverter(java.lang.String encoding,
java.lang.String mode)
Possible values for the conversion mode are:
PARAM_DISABLED: The conversion is disabled.
PARAM_ENABLED: Conversion is enabled without transformation, so html is pretty printed only.
PARAM_XHTML: Conversion from html to xhtml is enabled.
PARAM_WORD: Cleanup of word like html tags is enabled.
; separator, so it's possible to convert
to xhtml and clean from word at the same time.encoding - the encoding used for the html code conversionmode - the conversion mode to usepublic static boolean isConversionEnabled(java.lang.String conversionMode)
conversionMode - the content conversion mode stringpublic byte[] convertToByte(byte[] htmlInput)
throws java.io.UnsupportedEncodingException
htmlInput - html input stored in an array of bytesjava.io.UnsupportedEncodingException - if the encoding set for the conversion is not supportedpublic byte[] convertToByte(java.lang.String htmlInput)
throws java.io.UnsupportedEncodingException
htmlInput - html input stored in a stringjava.io.UnsupportedEncodingException - if the encoding set for the conversion is not supportedpublic byte[] convertToByteSilent(byte[] htmlInput)
If an any error occurs during the conversion process, the original input is returned unmodified.
htmlInput - html input stored in an array of bytespublic byte[] convertToByteSilent(java.lang.String htmlInput)
If an any error occurs during the conversion process, the original input is returned unmodified.
htmlInput - html input stored in a stringpublic java.lang.String convertToString(byte[] htmlInput)
throws java.io.UnsupportedEncodingException
htmlInput - html input stored in an array of bytesjava.io.UnsupportedEncodingException - if the encoding set for the conversion is not supportedpublic java.lang.String convertToString(java.lang.String htmlInput)
throws java.io.UnsupportedEncodingException
htmlInput - html input stored in a stringjava.io.UnsupportedEncodingException - if the encoding set for the conversion is not supportedpublic java.lang.String convertToStringSilent(byte[] htmlInput)
If an any error occurs during the conversion process, the original input is returned unmodified.
htmlInput - html input stored in an array of bytespublic java.lang.String convertToStringSilent(java.lang.String htmlInput)
If an any error occurs during the conversion process, the original input is returned unmodified.
htmlInput - html input stored in stringpublic java.lang.String getEncoding()
public static void main(java.lang.String[] args)