List of utility methods to do XML Unescape
String | unescapeXml(String xml) unescape Xml if (xml == null) return null; StringBuilder b = new StringBuilder(); int i = 0; while (i < xml.length()) { if (xml.charAt(i) == '&') { StringBuilder e = new StringBuilder(); i++; ... |
String | unescapeXML(String xml) unescape XML return xml.replace("<", "<").replace(">", ">").replace("&", "&"); |
String | unescapeXmlChars(String source) Unescape XML special characters (<, >, & and ") return source.replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&").replaceAll(""", "\""); |
String | unescapeXMLComment(String content) XML comment does not support some characters inside its content but there is no official escaping/unescaping for it so we made our own. StringBuffer str = new StringBuffer(content.length()); char[] buff = content.toCharArray(); boolean escaped = false; for (char c : buff) { if (!escaped && c == '\\') { escaped = true; continue; str.append(c); escaped = false; return str.toString(); |
String | unescapeXMLEntities(String text) Converts XML entities to characters. if (text.contains(">")) { text = text.replaceAll(">", ">"); if (text.contains("<")) { text = text.replaceAll("<", "<"); if (text.contains(""")) { text = text.replaceAll(""", "\""); ... |
String | unescapeXMLEntity(String str) unescape XML Entity if ("lt".equals(str)) return "<"; if ("gt".equals(str)) return ">"; if ("amp".equals(str)) return "&"; if ("apos".equals(str)) return "'"; ... |
String | unescapeXMLString(String str) unescape XML String StringBuffer rtn = new StringBuffer(); int posStart = -1; int posFinish = -1; while ((posStart = str.indexOf('&', posStart)) != -1) { int last = posFinish + 1; posFinish = str.indexOf(';', posStart); if (posFinish == -1) break; ... |
String | unescapeXMLString2(String str) unescape XML String StringBuffer sb = new StringBuffer(); int index, last = 0, indexSemi; while ((index = str.indexOf('&', last)) != -1) { sb.append(str.substring(last, index)); indexSemi = str.indexOf(';', index + 1); if (indexSemi == -1) { sb.append('&'); last = index + 1; ... |
String | unescapeXmlSymbols(String s1) unescape Xml Symbols String s2 = s1.replaceAll("<", "<"); s2 = s2.replaceAll(">", ">"); s2 = s2.replaceAll(">", ">"); s2 = s2.replaceAll("
", "\r"); s2 = s2.replaceAll("'", "'"); s2 = s2.replaceAll(""", "\""); s2 = s2.replaceAll("&", "&"); s2 = s2.replaceAll("
", "\n"); ... |