public class XML extends Object
This class provides static methods to escape and unescape XML special characters to ensure valid XML output and proper parsing of XML content.
The following characters are handled:
| Modifier and Type | Field and Description |
|---|---|
static String |
CHARSET_UTF8 |
static String |
DEFAULT_CONTENT_LANGUAGE |
static String |
DEFAULT_CONTENT_TYPE |
| Constructor and Description |
|---|
XML() |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeXMLChars(String input)
Escapes XML special characters in the input string, including quotes.
|
static String |
unescapeXMLChars(String input)
Unescapes XML entities in the input string.
|
public static final String CHARSET_UTF8
public static final String DEFAULT_CONTENT_LANGUAGE
public static final String DEFAULT_CONTENT_TYPE
public static final String escapeXMLChars(String input)
This is a convenience method that calls escapeXMLChars(String, boolean) with
quote set to true.
input - the string to escape, may be nullpublic static final String unescapeXMLChars(String input)
This method replaces the following XML entities with their characters:
input - string to unescape, may be null