src/it/finsiel/siged/util/HtmlParser.java
public static String textToHtml(String text, String title, String css) {
        // convert special characters
        String html = HtmlParser.substituteSpecialCharacters(text);

        // parse for urls / email adresses and substite with HTML-code
        html = HtmlParser.substituteURL(html);
        html = HtmlParser.substituteEmailAddress(html);

        // insert surrounding html tags
        StringBuffer buf = new StringBuffer();
        buf.append("<html>\n");
        buf.append("<head>\n");

        if (title != null) {
            buf.append("<title>\n");
            buf.append(title);
            buf.append("\n</title>");
        }

        if (css != null) {
            buf.append("\n<style type=\"text/css\"><!-- ");
            buf.append(css);
            buf.append(" -->\n</style>\n");
        }

        buf.append("</head>\n<body>\n");
        buf.append("<div>");
        buf.append(html);
        buf.append("</div>");
        buf.append("</body>");
        buf.append("</html>");

        return buf.toString();
    }
/**
     * Replaces special chars - <,>,&,\t,\n," - with the special entities used
     * in html (amp, nbsp, ...). Then the complete text is surrounded with
     * proper html tags: Starting- and ending html tag, header section and body
     * section. The complete body section is sorround with p tags. <br>
     * This is the same as first calling substituteSpecialCharacters and then
     * add starting and ending html tags etc. <br>
     * Further more urls and email adresses are converted into links Optionally
     * a title and css definition is inserted in the html header. <br>
     * 
     * TODO : Add support for smilies and coloring of quoted text
     * 
     * @param text
     *            Text to convert to html
     * @param title
     *            Title to include in header, not used if null
     * @param css
     *            Style sheet def. to include in header, not used if null. The
     *            input shall not include the style tag
     * @return Text converted to html
     */
Replaces special chars - <,>,&,\t,\n," - with the special entities used
in html (amp, nbsp, ...). Then the complete text is surrounded with
proper html tags: Starting- and ending html tag, header section and body
section. The complete body section is sorround with p tags. 
This is the same as first calling substituteSpecialCharacters and then
add starting and ending html tags etc. 
Further more urls and email adresses are converted into links Optionally
a title and css definition is inserted in the html header.



@param text
Text to convert to html
@param title
Title to include in header, not used if null
@param css
Style sheet def. to include in header, not used if null. The
input shall not include the style tag
@return Text converted to html
Replaces special chars - < > & \ t \ n " - with the special entities used in html ( amp nbsp ... ) . Then the complete text is surrounded with proper html tags : Starting - and ending html tag header section and body section . The complete body section is sorround with p tags . This is the same as first calling substituteSpecialCharacters and then add starting and ending html tags etc . Further more urls and email adresses are converted into links Optionally a title and css definition is inserted in the html header . @param text Text to convert to html @param title Title to include in header not used if null @param css Style sheet def . to include in header not used if null . The input shall not include the style tag @return Text converted to html
public static String textToHtml(String text, String title, String css) {
        String html = HtmlParser.substituteSpecialCharacters(text);
        html = HtmlParser.substituteURL(html);
        html = HtmlParser.substituteEmailAddress(html);
        StringBuffer buf = new StringBuffer();
        buf.append("<html>\n");
        buf.append("<head>\n");
        if (title != null) {
            buf.append("<title>\n");
            buf.append(title);
            buf.append("\n</title>");
        }
        if (css != null) {
            buf.append("\n<style type=\"text/css\"><!-- ");
            buf.append(css);
            buf.append(" -->\n</style>\n");
        }
        buf.append("</head>\n<body>\n");
        buf.append("<div>");
        buf.append(html);
        buf.append("</div>");
        buf.append("</body>");
        buf.append("</html>");
        return buf.toString();
    }
public static String textToHtml ( String text , String title , String css ) { String html = HtmlParser . substituteSpecialCharacters ( text ) ; html = HtmlParser . substituteURL ( html ) ; html = HtmlParser . substituteEmailAddress ( html ) ; StringBuffer buf = new StringBuffer ( ) ; buf . append ( "<html>\n" ) ; buf . append ( "<head>\n" ) ; if ( title != null ) { buf . append ( "<title>\n" ) ; buf . append ( title ) ; buf . append ( "\n</title>" ) ; } if ( css != null ) { buf . append ( "\n<style type=\"text/css\"><!-- " ) ; buf . append ( css ) ; buf . append ( " -->\n</style>\n" ) ; } buf . append ( "</head>\n<body>\n" ) ; buf . append ( "<div>" ) ; buf . append ( html ) ; buf . append ( "</div>" ) ; buf . append ( "</body>" ) ; buf . append ( "</html>" ) ; return buf . toString ( ) ; }
Replaces special chars - <,>,&,\t,\n," - with the special entities used
 in html (amp, nbsp, ...).
Replaces special chars - < > & \ t \ n " - with the special entities used in html ( amp nbsp ... ) .
// convert special characters // parse for urls / email adresses and substite with HTML-code // insert surrounding html tags