aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils/XmlHelper.java
blob: 299deed28ec94c122d6fffa28e847aecdc03beea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
package de.pixart.messenger.utils;

public class XmlHelper {
    public static String encodeEntities(String content) {
        content = content.replace("&", "&");
        content = content.replace("<", "&lt;");
        content = content.replace(">", "&gt;");
        content = content.replace("\"", "&quot;");
        content = content.replace("'", "&apos;");
        content = content.replaceAll("[\\p{Cntrl}&&[^\n\t\r]]", "");
        return content;
    }
}