Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String decodeXML(String inXML) { Pattern p1 = Pattern.compile("<"); Matcher m1 = p1.matcher(inXML); // get a matcher object StringBuffer sb1 = new StringBuffer(); while (m1.find()) { m1.appendReplacement(sb1, "<"); } inXML = m1.appendTail(sb1).toString(); Pattern p2 = Pattern.compile(">"); Matcher m2 = p2.matcher(inXML); // get a matcher object StringBuffer sb2 = new StringBuffer(); while (m2.find()) { m2.appendReplacement(sb2, ">"); } String outXML = m2.appendTail(sb2).toString(); return outXML; } }