1 29 30 package com.caucho.xtpdoc; 31 32 import java.io.IOException ; 33 import java.io.PrintWriter ; 34 35 abstract public class Node implements ContentItem { 36 protected void writeHtmlText(PrintWriter out, String text) 37 throws IOException 38 { 39 int length = text.length(); 40 41 for (int i = 0; i < length; i++) { 42 char ch = text.charAt(i); 43 44 switch (ch) { 45 case '<': 46 out.print("<"); 47 break; 48 case '>': 49 out.print(">"); 50 break; 51 case '\'': 52 out.print("'"); 53 break; 54 case '\"': 55 out.print("""); 56 break; 57 case '&': 58 out.print("&"); 59 break; 60 default: 61 out.print(ch); 62 break; 63 } 64 } 65 } 66 } 67 | Popular Tags |