public class XmlEscape
Adapted from Unbescape - https://github.com/unbescape/unbescape/
Utility class for performing XML escape/unescape operations.
| Modifier and Type | Field and Description |
|---|---|
static XmlEscape |
INSTANCE
Adapted from Unbescape - https://github.com/unbescape/unbescape/
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
escapeXml(java.lang.String text)
Perform an XML 1.0 level 2 (markup-significant and all non-ASCII chars) escape operation
on a String input.
|
public static XmlEscape INSTANCE
Adapted from Unbescape - https://github.com/unbescape/unbescape/
Utility class for performing XML escape/unescape operations.
public java.lang.String escapeXml(java.lang.String text)
Perform an XML 1.0 level 2 (markup-significant and all non-ASCII chars) escape operation on a String input.
Level 2 means this method will escape:
The five markup-significant characters: <, >, &, " and '
All non ASCII characters.
This escape will be performed by replacing those chars by the corresponding XML Character Entity References (e.g. '<') when such CER exists for the replaced character, and replacing by a hexadecimal character reference (e.g. '␰') when there there is no CER for the replaced character.
This method is thread-safe.
text - the String to be escaped.