Class CmsHtmlImportConverter

java.lang.Object
org.opencms.workplace.tools.database.CmsHtmlImportConverter

public class CmsHtmlImportConverter extends Object
This class implements Html-converting routines based on tidy to modify the Html code of the imported Html pages.

Since:
6.0.0
  • Constructor Details

    • CmsHtmlImportConverter

      public CmsHtmlImportConverter(CmsHtmlImport htmlImport, boolean xmlMode)
      Default constructor, creates a new HtmlConverter.

      Parameters:
      htmlImport - reference to the htmlimport
      xmlMode - switch for setting the import to HTML or XML mode
  • Method Details

    • extractHtml

      public static String extractHtml(String content, String startpoint, String endpoint)
      Extracts the content of a HTML page.

      This method should be pretty robust and work even if the input HTML does not contains the specified matchers.

      Parameters:
      content - the content to extract the body from
      startpoint - the point where matching starts
      endpoint - the point where matching ends
      Returns:
      the extracted body tag content
    • convertHTML

      public void convertHTML(Reader input, Writer output, String startPattern, String endPattern, Hashtable properties)
      Transforms HTML code into user defined output.

      Parameters:
      input - Reader with HTML code
      output - Writer with transformed code
      startPattern - the start pattern definition for content extracting
      endPattern - the end pattern definition for content extracting
      properties - the file properties
    • convertHTML

      public String convertHTML(String filename, String inString, String startPattern, String endPattern, Hashtable properties)
      Transforms HTML code into user defined output.

      Parameters:
      filename - the absolute path in the real filesystem of the file to convert
      inString - String with HTML code
      startPattern - the start pattern definition for content extracting
      endPattern - the end pattern definition for content extracting
      properties - the file properties
      Returns:
      String with transformed code