Menu

#8 xmlUnescaping : add codes

open
nobody
None
5
2009-08-10
2009-08-10
No

in StringUtils.java

public static String xmlUnescaping(String text){
text = text.replaceAll("&","&");
text = text.replaceAll("&lt;","<");
text = text.replaceAll("&gt;",">");
text = text.replaceAll("&quot;","\"");
text = text.replaceAll("&apos;","\'");

text = text.replaceAll("&#x26;","&");
text = text.replaceAll("&#x3A;",":");
text = text.replaceAll("&#x3B;",";");
text = text.replaceAll("&#x3C;","<");
text = text.replaceAll("&#x3D;","=");
text = text.replaceAll("&#x3E;",">");
text = text.replaceAll("&#x3F;","?");
text = text.replaceAll("&#x5B;","[");
text = text.replaceAll("&#x5C;","\\");
text = text.replaceAll("&#x5D;","]");
text = text.replaceAll("&#x5E;","^");
text = text.replaceAll("&#x7B;","{");
text = text.replaceAll("&#x7D;","|");
text = text.replaceAll("&#x7E;","}");

return text;
}

Discussion


Log in to post a comment.