List of utility methods to do HTML Encode
String | toHtml(String value, String defaultValue) to Html if (value == null) return defaultValue; StringBuffer result = new StringBuffer(value.length()); char ch = ' '; for (int i = 0; i < value.length(); i++) { switch (ch = value.charAt(i)) { case '<': result.append("<"); ... |
String | toHTML(String xhtml) Unfortunately JEditorPane will only display HTML3.2, whereas to embed HTML in an xsd we must use XHTML so it will be valid XML. int startPos, endPos; while ((startPos = xhtml.indexOf("<?")) != -1 && (endPos = xhtml.indexOf("?>")) != -1) { xhtml = xhtml.substring(0, startPos) + xhtml.substring(endPos + 2); while ((startPos = xhtml.indexOf("/>")) != -1) { xhtml = xhtml.substring(0, startPos) + xhtml.substring(startPos + 1); return xhtml; ... |
String | toHtmlChars(String htmlReady) Description of the Method if (htmlReady != null) { htmlReady = replace(htmlReady, "\u00A1", "¡"); htmlReady = replace(htmlReady, "\u00A2", "¢"); htmlReady = replace(htmlReady, "\u00A3", "£"); htmlReady = replace(htmlReady, "\u00A4", "¤"); htmlReady = replace(htmlReady, "\u00A5", "¥"); htmlReady = replace(htmlReady, "\u00A6", "¦"); htmlReady = replace(htmlReady, "\u00A7", "§"); ... |
String | toHTMLContentString(String s, boolean replaceSpaces, boolean isXhtml) to HTML Content String return toHTMLString(s, replaceSpaces, isXhtml);
|
String | toHtmlCR(String text) Convert the C line break sequence : "\n", "\r", "\r\n" to HTML line break sequence. return replaceCR(text, "<br/>"); |
String | toHTMLEncode(String string) to HTML Encode if (string == null) { return null; string = string.replaceAll("<", "<"); string = string.replaceAll("\n", "<br />"); return string; |
String | toHTMLEscapedText(String s) to HTML Escaped Text return toXMLEscapedText(s).replaceAll("\n", "<br>\n"); |
String | toHtmlInput(String str) to Html Input if (str == null) return ""; String html = new String(str); html = html.replaceAll("<", "<"); html = html.replaceAll(">", ">"); return html; |
String | toHtmlLine(String input) to Html Line return ((input == null) ? "" : input + "<br/>"); |
String | toHTMLString(String in) to HTML String if (in == null || in.length() <= 0) { return ""; StringBuffer out = new StringBuffer(); for (int i = 0; i < in.length(); i++) { char c = in.charAt(i); if (c == '\'') out.append("'"); ... |