1StringBuffer sb = new StringBuffer();
2
3for(int i=0; i<content.length(); i++){
4
5char c = content.charAt(i);
6
7 switch (c) {
8
9 case '<' :
10
11 sb.append("<");
12
13 break;
14
15 case '>' :
16
17 sb.append(">");
18
19 break;
20
21 case '&' :
22
23 sb.append("&");
24
25 break;
26
27 case '"' :
28
29 sb.append(""");
30
31 break;
32
33 case '\'' :
34
35 sb.append("'");
36
37 break;
38
39 default:
40
41 sb.append(c);
42
43 }
44
45}
46
47