|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.util.CmsHtmlConverter
public class CmsHtmlConverter
HTML cleaner and pretty printer.
Used to clean up HTML code (e.g. remove word tags) and optionally create XHTML from HTML.
Field Summary | |
---|---|
static java.lang.String |
PARAM_DISABLED
Parameter value for disabled mode. |
static java.lang.String |
PARAM_ENABLED
Parameter value for enabled mode. |
static java.lang.String |
PARAM_REPLACE_PARAGRAPHS
Parameter value for replace paragraph mode. |
static java.lang.String |
PARAM_WORD
Parameter value for WORD mode. |
static java.lang.String |
PARAM_XHTML
Parameter value for XHTML mode. |
static char |
SEPARATOR_MODES
The separator used for the configured modes String. |
Constructor Summary | |
---|---|
CmsHtmlConverter()
Constructor, creates a new CmsHtmlConverter. |
|
CmsHtmlConverter(java.lang.String encoding,
java.lang.String mode)
Constructor, creates a new CmsHtmlConverter. |
Method Summary | |
---|---|
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 the 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. |
static java.lang.String |
getConversionSettings(CmsObject cms,
CmsResource resource)
Reads the content conversion property of a given resource and returns its value. |
java.lang.String |
getEncoding()
Returns the encoding used for the HTML code conversion. |
java.lang.String |
getMode()
Returns the conversion mode to use. |
static boolean |
isConversionEnabled(java.lang.String conversionMode)
Tests if the content conversion is enabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PARAM_DISABLED
public static final java.lang.String PARAM_ENABLED
public static final java.lang.String PARAM_REPLACE_PARAGRAPHS
public static final java.lang.String PARAM_WORD
public static final java.lang.String PARAM_XHTML
public static final char SEPARATOR_MODES
Constructor Detail |
---|
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 default 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 is e.g. 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 useMethod Detail |
---|
public static java.lang.String getConversionSettings(CmsObject cms, CmsResource resource)
A default value (disabled) is returned if the property could not be read.
cms
- the CmsObjectresource
- the resource in the VFS
public static boolean isConversionEnabled(java.lang.String conversionMode)
conversionMode
- the content conversion mode string
public byte[] convertToByte(byte[] htmlInput) throws java.io.UnsupportedEncodingException
htmlInput
- HTML input stored in an array of bytes
java.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 string
java.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 bytes
public 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 string
public java.lang.String convertToString(byte[] htmlInput) throws java.io.UnsupportedEncodingException
htmlInput
- HTML input stored in an array of bytes
java.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 string
java.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 bytes
public 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 string
public java.lang.String getEncoding()
public java.lang.String getMode()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |