Here you can find the source of unescapeXml(String xml)
public static String unescapeXml(String xml) throws Exception
//package com.java2s; public class Main { public static String unescapeXml(String xml) throws Exception { 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++;/*ww w . ja va 2 s .com*/ while (xml.charAt(i) != ';') { e.append(xml.charAt(i)); i++; } if (e.toString().equals("lt")) b.append("<"); else if (e.toString().equals("gt")) b.append(">"); else if (e.toString().equals("amp")) b.append("&"); else if (e.toString().equals("quot")) b.append("\""); else if (e.toString().equals("mu")) b.append((char) 956); else throw new Exception("unknown XML entity \"" + e.toString() + "\""); } else b.append(xml.charAt(i)); i++; } return b.toString(); } }