Java examples for XML:XML String Escape
Unescape XML characters, and also replace our special token for preserving a carriage return followed by a line feed.
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String body = "java2s.com"; System.out.println(unescapeBody(body)); }//w w w . ja v a 2s. c o m /** * Unescape XML characters, and also replace our special token for preserving a carriage return followed by a line * feed. * * @param body * @return */ public static String unescapeBody(String body) { body = body.replace("<", "<"); body = body.replace(">", ">"); body = body.replace("CARRIAGERETURN\n", "\r\n"); return body; } }