Package com.sodius.oslc.core.util
Class Escapers
- java.lang.Object
-
- com.sodius.oslc.core.util.Escapers
-
public class Escapers extends Object
Escapers suitable for strings to be included in HTML or XML contents.- Since:
- 3.7.0
-
-
Field Summary
Fields Modifier and Type Field Description static UnaryOperator<String>
HTML
Escapes HTML metacharacters as specified by HTML 4.01.static UnaryOperator<String>
XML_CONTENT
Escapes special characters in a string so it can safely be included in an XML document as element content.
-
-
-
Field Detail
-
XML_CONTENT
public static final UnaryOperator<String> XML_CONTENT
Escapes special characters in a string so it can safely be included in an XML document as element content. See section 2.4 of the XML specification.Note: Double and single quotes are not escaped, so it is not safe to use this escaper to escape attribute values.
-
HTML
public static final UnaryOperator<String> HTML
Escapes HTML metacharacters as specified by HTML 4.01. The resulting strings can be used both in attribute values and in most elements' text contents, provided that the HTML document's character encoding can encode any non-ASCII code points in the input (as UTF-8 and other Unicode encodings can).Note: This escaper only performs minimal escaping to make content structurally compatible with HTML. Specifically, it does not perform entity replacement (symbolic or numeric), so it does not replace non-ASCII code points with character references. This escaper escapes only the following five ASCII characters:
'"&<>
.
-
-