Java Utililty Methods XML Unescape

List of utility methods to do XML Unescape

Description

The list of methods to do XML Unescape are organized into topic(s).

Method

StringunescapeXml(String input)
Unescape all XML entity references characters from an escaped XML string
String ret = input;
for (int i = 0; i < replaceBy.length; i++) {
    ret = ret.replace(replaceBy[i], unwanted[i]);
return ret;
StringunescapeXML(String s)
unescape XML
if (s == null) {
    return "";
String ret = s;
for (int i = 0; i < XMLescapes.length; i++) {
    String[] escapeEntry = (String[]) XMLescapes[i];
    ret = ret.replaceAll(escapeEntry[1], escapeEntry[0]);
return ret;
StringunescapeXml(String src)
unescape Xml
if (src == null || src.trim().length() == 0)
    return src;
StringBuilder result = new StringBuilder();
int length = src.length();
for (int i = 0; i < length; i++) {
    char ch = src.charAt(i);
    if (ch != '&') {
        result.append(ch);
...
StringunescapeXML(String str)
Returns a string with XML entities replaced by their normal characters.
if (str == null || str.length() == 0)
    return "";
StringBuilder buf = new StringBuilder();
int len = str.length();
for (int i = 0; i < len; ++i) {
    char c = str.charAt(i);
    if (c == '&') {
        int pos = str.indexOf(";", i);
...
StringunescapeXml(String str)
unescape Xml
str = str.replaceAll("&amp;", "&");
str = str.replaceAll("&lt;", "<");
str = str.replaceAll("&gt;", ">");
str = str.replaceAll("&quot;", "\"");
str = str.replaceAll("&apos;", "'");
return str;
StringunescapeXml(String str)
unescape Xml
str = replace(str, "&quot;", "\"");
str = replace(str, "&lt;", "<");
str = replace(str, "&gt;", ">");
str = replace(str, "&amp;", "&");
str = replace(str, "&apos;", "'");
return str;
StringunescapeXML(String text)
Unescapes specified string.
StringBuffer unescaped = new StringBuffer();
unescapeXML(text, 0, text.length(), unescaped);
return unescaped.toString();
StringunescapeXML(String text)
unescape a String in XML.
if (text.contains("&")) {
    StringBuilder result = new StringBuilder(text.length());
    int n = text.length();
    for (int i = 0; i < n; i++) {
        char c = text.charAt(i);
        if (c == '&') {
            for (int unescaped_index = 0; unescaped_index < to_unescape.length; unescaped_index++) {
                String pattern = to_unescape[unescaped_index];
...
StringunescapeXml(String value)
unescape Xml
if (value == null || value.length() == 0) {
    return value;
StringBuilder buf = null;
int len = value.length();
int len3 = len - 3;
for (int i = 0; i < len; i++) {
    char ch = value.charAt(i);
...
StringunescapeXml(String value)
unescape Xml
if (value != null) {
    StringBuilder result = new StringBuilder(value.length());
    int i = 0;
    int n = value.length();
    while (i < n) {
        char charAt = value.charAt(i);
        if (charAt != '&') {
            result.append(charAt);
...