/** * Encodes a string to HTML-safe text. The following characters are replaced: * <ul> * <li><code>&</code> with <code>&amp;</code></li> * <li><code><</code> with <code>&lt;</code></li> * <li><code>></code> with <code>&gt;</code></li> * <li><code>\u00A0</code> with <code> </code></li> * </ul> */ public static String text(final CharSequence text) { return encode(text, TEXT, LEN); }
/** * Encodes XML string. In XML there are only 5 predefined character entities. */ public static String xml(final CharSequence text) { return encode(text, TEXT_XML, LEN_XML); }
/** * Encodes attribute value that will be double quoted. * In this case, only these entities are encoded: * <ul> * <li><code>&</code> with <code>&amp;</code></li> * <li><code>"</code> with <code>&quot;</code></li> * <li><code>& </code></li> * </ul> */ public static String attributeDoubleQuoted(final CharSequence value) { return encode(value, ATTR_DQ, LEN); }
/** * Encodes attribute value that will be single quoted. * In this case, only two entities are encoded: * <ul> * <li><code>&</code> with <code>&amp;</code></li> * <li><code>'</code> with <code>&#39;</code></li> * <li><code>& </code></li> * </ul> */ public static String attributeSingleQuoted(final CharSequence value) { return encode(value, ATTR_SQ, LEN); }
/** * Encodes attribute value that will be single quoted. * In this case, only two entities are encoded: * <ul> * <li><code>&</code> with <code>&amp;</code></li> * <li><code>'</code> with <code>&#39;</code></li> * <li><code>& </code></li> * </ul> */ public static String attributeSingleQuoted(final CharSequence value) { return encode(value, ATTR_SQ, LEN); }
/** * Encodes XML string. In XML there are only 5 predefined character entities. */ public static String xml(final CharSequence text) { return encode(text, TEXT_XML, LEN_XML); }
/** * Encodes attribute value that will be double quoted. * In this case, only these entities are encoded: * <ul> * <li><code>&</code> with <code>&amp;</code></li> * <li><code>"</code> with <code>&quot;</code></li> * <li><code>& </code></li> * </ul> */ public static String attributeDoubleQuoted(final CharSequence value) { return encode(value, ATTR_DQ, LEN); }
/** * Encodes a string to HTML-safe text. The following characters are replaced: * <ul> * <li><code>&</code> with <code>&amp;</code></li> * <li><code><</code> with <code>&lt;</code></li> * <li><code>></code> with <code>&gt;</code></li> * <li><code>\u00A0</code> with <code> </code></li> * </ul> */ public static String text(final CharSequence text) { return encode(text, TEXT, LEN); }