Codota Logo
CmsHtmlConverter
Code IndexAdd Codota to your IDE (free)

How to use
CmsHtmlConverter
in
org.opencms.util

Best Java code snippets using org.opencms.util.CmsHtmlConverter (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: org.opencms/opencms-core

/**
 * Repairs the given HTML input by adding potentially missing closing tags.<p>
 *
 * @param input the HTML input
 *
 * @return the repaired HTML or an empty string in case of errors
 */
public static String repairHtml(String input) {
  CmsHtmlConverter converter = new CmsHtmlConverter();
  String result = converter.convertToStringSilent(input);
  return result == null ? "" : result;
}
origin: org.opencms/opencms-solr

/**
 * Converts the given HTML code according to the settings of this converter.<p>
 * 
 * @param htmlInput HTML input stored in an array of bytes
 * @return array of bytes containing the converted HTML
 * 
 * @throws UnsupportedEncodingException if the encoding set for the conversion is not supported
 */
public byte[] convertToByte(byte[] htmlInput) throws UnsupportedEncodingException {
  return convertToByte(new String(htmlInput, getEncoding()));
}
origin: org.opencms/opencms-core

/**
 * Converts the given HTML code according to the settings of this converter.<p>
 *
 * @param htmlInput HTML input stored in a string
 * @return array of bytes containing the converted HTML
 *
 * @throws UnsupportedEncodingException if the encoding set for the conversion is not supported
 */
public byte[] convertToByte(String htmlInput) throws UnsupportedEncodingException {
  return convertToString(htmlInput).getBytes(getEncoding());
}
origin: org.opencms/opencms-core

if (CmsHtmlConverter.isConversionEnabled(contentConversion)) {
  CmsHtmlConverter converter = new CmsHtmlConverter(encoding, contentConversion);
  finalValue = converter.convertToStringSilent(finalValue);
  finalValue = fixNullCharacters(finalValue);
origin: org.opencms/org.opencms.editors.fckeditor

  /**
   * @see org.opencms.workplace.editors.CmsSimplePageEditor#prepareContent(boolean)
   */
  protected String prepareContent(boolean save) {

    if (save) {
      String conversionSetting = CmsHtmlConverter.getConversionSettings(getCms(), m_file);
      if (CmsStringUtil.isEmptyOrWhitespaceOnly(conversionSetting)) {
        // by default we want to pretty-print and Xhtml format when saving the content in FCKeditor
        String content = getParamContent();
        CmsHtmlConverter converter = new CmsHtmlConverter(getEncoding(), CmsHtmlConverter.PARAM_XHTML);
        content = converter.convertToStringSilent(content);
        setParamContent(content);
      }
    }
    // do further processing with super class
    return super.prepareContent(true);
  }
}
origin: org.opencms/opencms-solr

  /**
   * Internally tidies with cleanup and XHTML.<p> 
   * 
   * @param content HTML to clean 
   * 
   * @return the tidy HTML
   */
  private String tidy(final String content) {

    CmsHtmlConverter converter = new CmsHtmlConverter(CmsEncoder.ENCODING_UTF_8, new StringBuffer(
      CmsHtmlConverter.PARAM_WORD).append(";").append(CmsHtmlConverter.PARAM_XHTML).toString());
    String result = content;
    try {
      result = converter.convertToString(content);
    } catch (UnsupportedEncodingException e) {
      // should never happen
      if (LOG.isWarnEnabled()) {
        LOG.warn(Messages.get().getBundle().key(Messages.LOG_WARN_TIDY_FAILURE_0), e);
      }
    }
    return result;
  }
}
origin: org.opencms/opencms-solr

String contentConversion = CmsHtmlConverter.getConversionSettings(cms, resource);
xmlPage.setConversion(contentConversion);
origin: org.opencms/opencms-solr

for (Iterator i = getModes().iterator(); i.hasNext();) {
  String mode = (String)i.next();
  String converterClass = OpenCms.getResourceManager().getHtmlConverter(mode);
    I_CmsHtmlConverter converter = (I_CmsHtmlConverter)Class.forName(className).newInstance();
    converter.init(getEncoding(), modes);
origin: org.opencms/opencms-solr

/**
 * Constructor, creates a new CmsHtmlConverter.<p>
 * 
 * The encoding used by default is {@link CmsEncoder#ENCODING_UTF_8}.<p>
 */
public CmsHtmlConverter() {
  init(CmsEncoder.ENCODING_UTF_8, PARAM_ENABLED);
}
origin: org.opencms/opencms-core

/**
 * Returns the conversion modes to use as List of String parameters.<p>
 *
 * @return the conversion modes to use as List of String parameters
 */
private List<String> getModes() {
  List<String> modes = new ArrayList<String>();
  try {
    modes = CmsStringUtil.splitAsList(getMode(), SEPARATOR_MODES, true);
  } catch (Exception e) {
    // error generating list, an empty list will be returned
  }
  return modes;
}
origin: org.opencms/opencms-core

/**
 * Converts the given HTML code according to the settings of this converter.<p>
 *
 * If an any error occurs during the conversion process, the original input is returned unmodified.<p>
 *
 * @param htmlInput HTML input stored in string
 *
 * @return string containing the converted HTML
 */
public String convertToStringSilent(String htmlInput) {
  try {
    return convertToString(htmlInput);
  } catch (Exception e) {
    if (LOG.isWarnEnabled()) {
      LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e);
    }
    return htmlInput;
  }
}
origin: org.opencms/opencms-solr

/**
 * Converts the given HTML code according to the settings of this converter.<p>
 * 
 * If an any error occurs during the conversion process, the original input is returned unmodified.<p>
 * 
 * @param htmlInput HTML input stored in an array of bytes
 * @return array of bytes containing the converted HTML
 */
public byte[] convertToByteSilent(byte[] htmlInput) {
  try {
    return convertToByte(htmlInput);
  } catch (Exception e) {
    if (LOG.isWarnEnabled()) {
      LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e);
    }
    return htmlInput;
  }
}
origin: org.opencms/opencms-solr

if (CmsHtmlConverter.isConversionEnabled(contentConversion)) {
  CmsHtmlConverter converter = new CmsHtmlConverter(encoding, contentConversion);
  finalValue = converter.convertToStringSilent(finalValue);
origin: org.opencms/opencms-core

  /**
   * Internally tidies with cleanup and XHTML.<p>
   *
   * @param content HTML to clean
   *
   * @return the tidy HTML
   */
  private String tidy(final String content) {

    CmsHtmlConverter converter = new CmsHtmlConverter(
      CmsEncoder.ENCODING_UTF_8,
      new StringBuffer(CmsHtmlConverter.PARAM_WORD).append(";").append(CmsHtmlConverter.PARAM_XHTML).toString());
    String result = content;
    try {
      result = converter.convertToString(content);
    } catch (UnsupportedEncodingException e) {
      // should never happen
      if (LOG.isWarnEnabled()) {
        LOG.warn(Messages.get().getBundle().key(Messages.LOG_WARN_TIDY_FAILURE_0), e);
      }
    }
    return result;
  }
}
origin: org.opencms/opencms-core

String contentConversion = CmsHtmlConverter.getConversionSettings(cms, resource);
xmlPage.setConversion(contentConversion);
origin: org.opencms/opencms-core

for (Iterator<String> i = getModes().iterator(); i.hasNext();) {
  String mode = i.next();
  String converterClass = OpenCms.getResourceManager().getHtmlConverter(mode);
    I_CmsHtmlConverter converter = (I_CmsHtmlConverter)Class.forName(className).newInstance();
    converter.init(getEncoding(), modes);
origin: org.opencms/opencms-core

/**
 * Constructor, creates a new CmsHtmlConverter.<p>
 *
 * The encoding used by default is {@link CmsEncoder#ENCODING_UTF_8}.<p>
 */
public CmsHtmlConverter() {
  init(CmsEncoder.ENCODING_UTF_8, PARAM_ENABLED);
}
origin: org.opencms/opencms-solr

/**
 * Returns the conversion modes to use as List of String parameters.<p>
 * 
 * @return the conversion modes to use as List of String parameters
 */
private List getModes() {
  List modes = new ArrayList();
  try {
    modes = CmsStringUtil.splitAsList(getMode(), SEPARATOR_MODES, true);
  } catch (Exception e) {
    // error generating list, an empty list will be returned
  }
  return modes;
}
origin: org.opencms/opencms-solr

/**
 * Converts the given HTML code according to the settings of this converter.<p>
 * 
 * If an any error occurs during the conversion process, the original input is returned unmodified.<p>
 * 
 * @param htmlInput HTML input stored in string 
 * 
 * @return string containing the converted HTML
 */
public String convertToStringSilent(String htmlInput) {
  try {
    return convertToString(htmlInput);
  } catch (Exception e) {
    if (LOG.isWarnEnabled()) {
      LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e);
    }
    return htmlInput;
  }
}
origin: org.opencms/opencms-core

/**
 * Converts the given HTML code according to the settings of this converter.<p>
 *
 * If an any error occurs during the conversion process, the original input is returned unmodified.<p>
 *
 * @param htmlInput HTML input stored in an array of bytes
 * @return array of bytes containing the converted HTML
 */
public byte[] convertToByteSilent(byte[] htmlInput) {
  try {
    return convertToByte(htmlInput);
  } catch (Exception e) {
    if (LOG.isWarnEnabled()) {
      LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e);
    }
    return htmlInput;
  }
}
org.opencms.utilCmsHtmlConverter

Javadoc

HTML cleaner and pretty printer.

Used to clean up HTML code (e.g. remove word tags) and optionally create XHTML from HTML.

Most used methods

  • <init>
    Constructor, creates a new CmsHtmlConverter. Possible values for the default conversion mode are: *
  • convertToStringSilent
    Converts the given HTML code according to the settings of this converter. If an any error occurs dur
  • getConversionSettings
    Reads the content conversion property of a given resource and returns its value. A default value (d
  • convertToByte
    Converts the given HTML code according to the settings of this converter.
  • convertToString
    Converts the given HTML code according to the settings of this converter.
  • getEncoding
    Returns the encoding used for the HTML code conversion.
  • getMode
    Returns the conversion mode to use.
  • getModes
    Returns the conversion modes to use as List of String parameters.
  • init
    Initializes the HTML converter instance. Possible values for the conversion mode are dependent from
  • isConversionEnabled
    Tests if the content conversion is enabled.

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • onCreateOptionsMenu (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now