Class CmsHtmlImportConverter
java.lang.Object
org.opencms.workplace.tools.database.CmsHtmlImportConverter
This class implements Html-converting routines based on tidy to modify the
Html code of the imported Html pages.
- Since:
- 6.0.0
-
Constructor Summary
ConstructorDescriptionCmsHtmlImportConverter
(CmsHtmlImport htmlImport, boolean xmlMode) Default constructor, creates a new HtmlConverter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
convertHTML
(Reader input, Writer output, String startPattern, String endPattern, Hashtable properties) Transforms HTML code into user defined output.convertHTML
(String filename, String inString, String startPattern, String endPattern, Hashtable properties) Transforms HTML code into user defined output.static String
extractHtml
(String content, String startpoint, String endpoint) Extracts the content of a HTML page.
-
Constructor Details
-
CmsHtmlImportConverter
Default constructor, creates a new HtmlConverter.- Parameters:
htmlImport
- reference to the htmlimportxmlMode
- switch for setting the import to HTML or XML mode
-
-
Method Details
-
extractHtml
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 fromstartpoint
- the point where matching startsendpoint
- 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 codeoutput
- Writer with transformed codestartPattern
- the start pattern definition for content extractingendPattern
- the end pattern definition for content extractingproperties
- 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 convertinString
- String with HTML codestartPattern
- the start pattern definition for content extractingendPattern
- the end pattern definition for content extractingproperties
- the file properties- Returns:
- String with transformed code
-